From 9e9c63c792bfa30df35a93b296faaee2dec53a70 Mon Sep 17 00:00:00 2001 From: Modderan Date: Sun, 5 Jul 2026 07:42:51 -0700 Subject: [PATCH] Fix silent truncation of UDP datagrams over 1024 bytes recvfrom() into a 1 KB buffer clips any larger datagram and the tail is lost. A compressed position packet from a client with several moving vehicles exceeds that, so those updates were silently dropped and the remote vehicles stuttered/warped. Size the receive buffer to the UDP maximum instead. Co-Authored-By: Claude Fable 5 --- src/TNetwork.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/TNetwork.cpp b/src/TNetwork.cpp index 3cf8b75c..203805e2 100644 --- a/src/TNetwork.cpp +++ b/src/TNetwork.cpp @@ -1356,7 +1356,10 @@ bool TNetwork::UDPSend(TClient& Client, std::vector Data) { } std::vector TNetwork::UDPRcvFromClient(boost::asio::ip::udp::endpoint& ClientEndpoint) { - std::array Ret { }; + // Sized to the UDP maximum: recvfrom() truncates a datagram that exceeds the buffer + // (the tail is silently lost). A compressed position packet from a client with several + // moving vehicles can exceed 1024 bytes, so such updates were silently dropped. + std::array Ret { }; boost::system::error_code ec; const auto Rcv = mUDPSock.receive_from(boost::asio::mutable_buffer(Ret.data(), Ret.size()), ClientEndpoint, 0, ec); if (ec) {