aboutsummaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorSmallJoker <mk939@ymail.com>2018-06-24 14:35:29 +0200
committerSmallJoker <mk939@ymail.com>2018-06-24 14:48:19 +0200
commit1d1cf000c023b77721ad8cb226330ca6a72a1acc (patch)
treee39263af36b0db039cb4b0d318014b1ae652b149 /src/network
parent6b72d8d090d001737f18561ae5e036a440a01cbb (diff)
downloadminetest-1d1cf000c023b77721ad8cb226330ca6a72a1acc.tar.gz
minetest-1d1cf000c023b77721ad8cb226330ca6a72a1acc.tar.bz2
minetest-1d1cf000c023b77721ad8cb226330ca6a72a1acc.zip
Fix rtt >= 0.0f assertion and free_move crash
Diffstat (limited to 'src/network')
-rw-r--r--src/network/connectionthreads.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/network/connectionthreads.cpp b/src/network/connectionthreads.cpp
index 9d948c59a..c4e512119 100644
--- a/src/network/connectionthreads.cpp
+++ b/src/network/connectionthreads.cpp
@@ -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);