MCPcopy Create free account
hub / github.com/catboost/catboost / Push

Method Push

library/cpp/netliba/socket/packet_queue.h:54–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52 }
53
54 bool Push(TUdpRecvPacket* packet, const TPacketMeta& meta) {
55 // simulate OS behavior on buffer overflow - drop packets.
56 // yeah it contains small data race (we can add little bit more packets, but nobody cares)
57 if (AtomicGet(NumPackets) >= MAX_PACKETS_IN_QUEUE || AtomicGet(DataSize) >= MAX_DATA_IN_QUEUE) {
58 return false;
59 }
60 AtomicAdd(NumPackets, 1);
61 AtomicAdd(DataSize, packet->DataSize);
62 Y_ASSERT(packet->DataStart == 0);
63
64 Queue.Enqueue(TPacket(std::make_pair(packet, meta)));
65 QueueEvent.Signal();
66 return true;
67 }
68
69 bool Pop(TUdpRecvPacket** packet, sockaddr_in6* srcAddr, sockaddr_in6* dstAddr) {
70 TPacket p;

Callers

nothing calls this directly

Calls 5

TPacketClass · 0.85
AtomicGetFunction · 0.50
AtomicAddFunction · 0.50
EnqueueMethod · 0.45
SignalMethod · 0.45

Tested by

no test coverage detected