From 4979b629c2e7bcc0dea2a584bfcfd385fd0da297 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 8 Jul 2023 11:14:46 -0500 Subject: [PATCH] Fix build after removal of roundTripTimeoutLimit --- protocol.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/protocol.c b/protocol.c index 3276a05..bee7430 100644 --- a/protocol.c +++ b/protocol.c @@ -1346,6 +1346,7 @@ enet_protocol_check_timeouts (ENetHost * host, ENetPeer * peer, ENetEvent * even { ENetOutgoingCommand * outgoingCommand; ENetListIterator currentCommand, insertPosition, insertSendReliablePosition; + enet_uint32 roundTripTimeout; currentCommand = enet_list_begin (& peer -> sentReliableCommands); insertPosition = enet_list_begin (& peer -> outgoingCommands); @@ -1376,9 +1377,11 @@ enet_protocol_check_timeouts (ENetHost * host, ENetPeer * peer, ENetEvent * even ++ peer -> packetsLost; - outgoingCommand -> roundTripTimeout *= 2; - if (outgoingCommand -> roundTripTimeout > outgoingCommand -> roundTripTimeoutLimit) - outgoingCommand -> roundTripTimeout = outgoingCommand -> roundTripTimeoutLimit; + roundTripTimeout = peer -> roundTripTime + 4 * ENET_MAX (1, peer -> roundTripTimeVariance); + if (outgoingCommand -> sendAttempts < peer -> timeoutLimit) + outgoingCommand -> roundTripTimeout = roundTripTimeout * ENET_MAX (1, outgoingCommand -> sendAttempts); + else + outgoingCommand -> roundTripTimeout = roundTripTimeout * peer -> timeoutLimit; if (outgoingCommand -> packet != NULL) {