1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Fix rtt >= 0.0f assertion and free_move crash

This commit is contained in:
SmallJoker 2018-06-24 14:35:29 +02:00
parent 6b72d8d090
commit 1d1cf000c0
3 changed files with 14 additions and 13 deletions

View file

@ -1167,7 +1167,7 @@ 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;
float rtt = 0.0f;
if (current_time > p.absolute_send_time) {
rtt = (current_time - p.absolute_send_time) / 1000.0f;
} else if (p.totaltime > 0) {
@ -1176,7 +1176,8 @@ SharedBuffer<u8> ConnectionReceiveThread::handlePacketType_Control(Channel *chan
// Let peer calculate stuff according to it
// (avg_rtt and resend_timeout)
dynamic_cast<UDPPeer *>(peer)->reportRTT(rtt);
if (rtt != 0.0f)
dynamic_cast<UDPPeer *>(peer)->reportRTT(rtt);
}
// put bytes for max bandwidth calculation
channel->UpdateBytesSent(p.data.getSize(), 1);