mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 16:45:20 +02:00
RTT fixes (#7428)
* Few code updates * Do not show average RTT before timing out * Fix unwanted integer division in RTTStatistics * Fix float format, prettier jitter calculation * Use +=, 0.1f -> 100.0f for stronger average updates
This commit is contained in:
@@ -1167,19 +1167,16 @@ SharedBuffer<u8> ConnectionReceiveThread::handlePacketType_Control(Channel *chan
|
||||
|
||||
// a overflow is quite unlikely but as it'd result in major
|
||||
// rtt miscalculation we handle it here
|
||||
float rtt;
|
||||
if (current_time > p.absolute_send_time) {
|
||||
float rtt = (current_time - p.absolute_send_time) / 1000.0;
|
||||
|
||||
// Let peer calculate stuff according to it
|
||||
// (avg_rtt and resend_timeout)
|
||||
dynamic_cast<UDPPeer *>(peer)->reportRTT(rtt);
|
||||
rtt = (current_time - p.absolute_send_time) / 1000.0f;
|
||||
} else if (p.totaltime > 0) {
|
||||
float rtt = p.totaltime;
|
||||
|
||||
// Let peer calculate stuff according to it
|
||||
// (avg_rtt and resend_timeout)
|
||||
dynamic_cast<UDPPeer *>(peer)->reportRTT(rtt);
|
||||
rtt = p.totaltime;
|
||||
}
|
||||
|
||||
// Let peer calculate stuff according to it
|
||||
// (avg_rtt and resend_timeout)
|
||||
dynamic_cast<UDPPeer *>(peer)->reportRTT(rtt);
|
||||
}
|
||||
// put bytes for max bandwidth calculation
|
||||
channel->UpdateBytesSent(p.data.getSize(), 1);
|
||||
|
Reference in New Issue
Block a user