Przeglądaj źródła

replaced exp backoff time for rel packet timeout with linear

Vladyslav Hrytsenko 7 lat temu
rodzic
commit
f2c0ec3c20
1 zmienionych plików z 6 dodań i 1 usunięć
  1. 6 1
      include/enet.h

+ 6 - 1
include/enet.h

@@ -2793,7 +2793,12 @@ extern "C" {
             }
 
             ++peer->packetsLost;
-            outgoingCommand->roundTripTimeout *= 2;
+
+            /* Replaced exponential backoff time with something more linear */
+            /* Source: http://lists.cubik.org/pipermail/enet-discuss/2014-May/002308.html */
+            outgoingCommand->roundTripTimeout = peer->roundTripTime + 4 * peer->roundTripTimeVariance;
+            outgoingCommand->roundTripTimeoutLimit = peer->timeoutLimit * outgoingCommand->roundTripTimeout;
+
             enet_list_insert(insertPosition, enet_list_remove(&outgoingCommand->outgoingCommandList));
 
             if (currentCommand == enet_list_begin(&peer->sentReliableCommands) && !enet_list_empty(&peer->sentReliableCommands)) {