| 225 | |
| 226 | static TAtomic transferIdCounter = (long)(GetCycleCount() & 0x1fffffff); |
| 227 | inline int GetTransferId() { |
| 228 | int res = AtomicAdd(transferIdCounter, 1); |
| 229 | while (res < 0) { |
| 230 | // negative transfer ids are treated as errors, so wrap transfer id |
| 231 | AtomicCas(&transferIdCounter, 0, transferIdCounter); |
| 232 | res = AtomicAdd(transferIdCounter, 1); |
| 233 | } |
| 234 | return res; |
| 235 | } |
| 236 | |
| 237 | static bool IBDetection = true; |
| 238 | class TUdpHost: public IUdpHost { |