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

Method Recv

library/cpp/netliba/v12/udp_socket.cpp:598–633  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

596 }
597
598 TUdpRecvPacket* TUdpSocket::Recv(TSockAddrPair* addr) {
599 TAutoPtr<TUdpRecvPacket> result = nullptr;
600
601 for (;;) {
602 result = RecvContinuationPacket(addr);
603 if (!!result) {
604 break;
605 }
606
607 result = S->Recv(&addr->RemoteAddr, &addr->MyAddr, UDP_NETLIBA_VERSION_V12);
608 if (!result) {
609 return nullptr;
610 }
611
612 Y_ASSERT(result->DataStart == 0);
613 const size_t recvSize = result->DataSize;
614
615 // skip whole corrupted packet even with small packet optimization
616 if (!CheckPacketIntegrity(result->Data.get(), recvSize, *addr)) {
617 continue;
618 }
619
620 result->DataSize = UDP_LOW_LEVEL_HEADER_SIZE + ReadPacketDataSize(result->Data.get());
621
622 if ((size_t)result->DataSize != recvSize) {
623 CacheContinuationUdpPacket(*result, recvSize, *addr);
624 }
625 break;
626 }
627
628 // fixes offsets also for continuation packets
629 result->DataStart += UDP_LOW_LEVEL_HEADER_SIZE;
630 result->DataSize -= UDP_LOW_LEVEL_HEADER_SIZE;
631
632 return result.Release();
633 }
634
635 float TUdpSocket::GetAndResetMergeRatio() {
636 if (SendStat.Total == 0)

Callers 2

RecvFromMethod · 0.45
RecvCycleMethod · 0.45

Calls 3

ReadPacketDataSizeFunction · 0.85
getMethod · 0.45
ReleaseMethod · 0.45

Tested by

no test coverage detected