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

Method CheckMTU

library/cpp/netliba/v12/udp_host.cpp:673–709  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

671 }
672
673 bool TUdpHost::CheckMTU(TConnection* connection, TUdpOutTransfer& xfer) {
674 Y_ASSERT(!xfer.AckTracker.IsInitialized());
675
676 TIntrusivePtr<TCongestionControl> congestion = xfer.AckTracker.GetCongestionControl();
677 Y_ASSERT(congestion.Get() != nullptr);
678 if (!congestion->IsKnownMTU()) {
679 TLameMTUDiscovery* md = congestion->GetMTUDiscovery();
680 if (md->IsTimedOut()) {
681 congestion->SetMTU(connection->GetSmallMtuUseXs() ? UDP_XSMALL_PACKET_SIZE : UDP_SMALL_PACKET_SIZE);
682
683 } else {
684 if (md->CanSend()) {
685 FlushPackets();
686 SendJumboPing(S, connection, S.GetNetworkOrderPort(), xfer.DataTos);
687 md->PingSent();
688 }
689 return false;
690 }
691 }
692
693 // try to use large mtu, we could have selected small mtu due to connectivity problems
694 if (congestion->GetMTU() == UDP_SMALL_PACKET_SIZE || congestion->GetMTU() == UDP_XSMALL_PACKET_SIZE || IB.Get() != nullptr) {
695 // recheck every ~50mb
696 int chkDenom = (50000000 / xfer.Data->GetSize()) | 1;
697 if ((NetAckRnd() % chkDenom) == 0) {
698 FlushPackets();
699
700 //printf("send rechecking ping\n");
701 if (congestion->GetMTU() == UDP_SMALL_PACKET_SIZE || congestion->GetMTU() == UDP_XSMALL_PACKET_SIZE) {
702 SendJumboPing(S, connection, S.GetNetworkOrderPort(), xfer.DataTos);
703 } else {
704 SendIBOnlyPing(S, connection, S.GetNetworkOrderPort());
705 }
706 }
707 }
708 return true;
709 }
710
711 void TUdpHost::InjectTransfers(TSendOrder* order, ui8 prio) {
712 for (TSendOrder::iterator z = order->begin(); z != order->end();) {

Callers

nothing calls this directly

Calls 15

SendJumboPingFunction · 0.85
SendIBOnlyPingFunction · 0.85
NetAckRndFunction · 0.70
IsInitializedMethod · 0.45
GetCongestionControlMethod · 0.45
GetMethod · 0.45
IsKnownMTUMethod · 0.45
GetMTUDiscoveryMethod · 0.45
IsTimedOutMethod · 0.45
SetMTUMethod · 0.45
GetSmallMtuUseXsMethod · 0.45
CanSendMethod · 0.45

Tested by

no test coverage detected