From 242740fbf56cd06923b960392375c17a9558f431 Mon Sep 17 00:00:00 2001 From: djoslin Date: Sat, 29 Apr 2023 00:43:34 -0700 Subject: [PATCH] Increase max resend attempts for the initial packet --- src/pc/network/packets/packet_reliable.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pc/network/packets/packet_reliable.c b/src/pc/network/packets/packet_reliable.c index 05b52534..17c33757 100644 --- a/src/pc/network/packets/packet_reliable.c +++ b/src/pc/network/packets/packet_reliable.c @@ -157,6 +157,7 @@ void network_update_reliable(void) { f32 elapsed = (clock_elapsed() - node->lastSend); f32 maxElapsed = get_max_elapsed_time(node->sendAttempts); maxElapsed = adjust_max_elapsed(node->p.packetType, maxElapsed); + if (maxElapsed > 3) { maxElapsed = 3; } // adjust resend time based on ping struct NetworkPlayer* np = &gNetworkPlayers[node->p.localIndex]; @@ -175,7 +176,9 @@ void network_update_reliable(void) { node->lastSend = clock_elapsed(); node->sendAttempts++; - if (node->sendAttempts >= MAX_RESEND_ATTEMPTS) { + + int maxResendAttempts = node->p.packetType == PACKET_MOD_LIST_REQUEST ? 60 : MAX_RESEND_ATTEMPTS; + if (node->sendAttempts >= maxResendAttempts) { struct PacketLinkedList* next = node->next; remove_node_from_list(node); node = next;