Increase max resend attempts for the initial packet

This commit is contained in:
djoslin 2023-04-29 00:43:34 -07:00
parent 7ee00a12a8
commit 242740fbf5
1 changed files with 4 additions and 1 deletions

View File

@ -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;