From ad5bf95397adc6feb866e9bcef40dced17ec6489 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 16 May 2021 15:35:02 -0500 Subject: [PATCH] fix excessive retransmissions when average RTT variance is 0 --- protocol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocol.c b/protocol.c index 5e93b63..26ffc9d 100644 --- a/protocol.c +++ b/protocol.c @@ -1466,7 +1466,7 @@ enet_protocol_check_outgoing_commands (ENetHost * host, ENetPeer * peer) if (outgoingCommand -> roundTripTimeout == 0) { - outgoingCommand -> roundTripTimeout = peer -> roundTripTime + 4 * peer -> roundTripTimeVariance; + outgoingCommand -> roundTripTimeout = peer -> roundTripTime + 4 * ENET_MAX (1, peer -> roundTripTimeVariance); outgoingCommand -> roundTripTimeoutLimit = peer -> timeoutLimit * outgoingCommand -> roundTripTimeout; }