Cap the retransmit timer at 1/5 of the max peer timeout

This helps avoiding spurious disconnections in cases of large RTT variance
This commit is contained in:
Cameron Gutman
2023-07-26 00:57:05 -05:00
parent bdda0eecc5
commit bbed828aae
+1
View File
@@ -1381,6 +1381,7 @@ enet_protocol_check_timeouts (ENetHost * host, ENetPeer * peer, ENetEvent * even
++ peer -> packetsLost;
roundTripTimeout = peer -> roundTripTime + 4 * ENET_MAX (1, peer -> roundTripTimeVariance);
roundTripTimeout = ENET_MIN (roundTripTimeout, peer->timeoutMaximum / 5);
if (outgoingCommand -> sendAttempts < peer -> timeoutLimit)
outgoingCommand -> roundTripTimeout = roundTripTimeout * ENET_MAX (1, outgoingCommand -> sendAttempts);
else