diff options
author | you <ovvv@web.de> | 2018-06-23 09:16:01 +0200 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2018-06-23 09:16:01 +0200 |
commit | 968ce9af598024ec71e9ffb2d15c3997a13ad754 (patch) | |
tree | 0ad28040f1deb3ca1885d5147b23931d237a76f5 /src/network/connectionthreads.cpp | |
parent | 07b1743d3db086f0f984968252d9e3ac71336a7e (diff) | |
download | minetest-968ce9af598024ec71e9ffb2d15c3997a13ad754.tar.xz |
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
Diffstat (limited to 'src/network/connectionthreads.cpp')
-rw-r--r-- | src/network/connectionthreads.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/network/connectionthreads.cpp b/src/network/connectionthreads.cpp index 37a435ad8..9d948c59a 100644 --- a/src/network/connectionthreads.cpp +++ b/src/network/connectionthreads.cpp @@ -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); |