mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00: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:
parent
07b1743d3d
commit
968ce9af59
5 changed files with 34 additions and 39 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue