| 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();) { |
nothing calls this directly
no test coverage detected