From 6991632abf1af161f332bf38bd8517c7c2834b58 Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Sat, 4 Apr 2020 12:30:54 -0400 Subject: accumulate fractional RTT values --- peer.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'peer.c') diff --git a/peer.c b/peer.c index e2d0872..2f483a2 100644 --- a/peer.c +++ b/peer.c @@ -306,11 +306,11 @@ enet_peer_reset_queues (ENetPeer * peer) { ENetChannel * channel; - if (peer -> needsDispatch) + if (peer -> flags & ENET_PEER_FLAG_NEEDS_DISPATCH) { enet_list_remove (& peer -> dispatchList); - peer -> needsDispatch = 0; + peer -> flags &= ~ ENET_PEER_FLAG_NEEDS_DISPATCH; } while (! enet_list_empty (& peer -> acknowledgements)) @@ -418,6 +418,9 @@ enet_peer_reset (ENetPeer * peer) peer -> outgoingUnsequencedGroup = 0; peer -> eventData = 0; peer -> totalWaitingData = 0; + peer -> flags = 0; + peer -> roundTripTimeRemainder = 0; + peer -> roundTripTimeVarianceRemainder = 0; memset (peer -> unsequencedWindow, 0, sizeof (peer -> unsequencedWindow)); @@ -724,11 +727,11 @@ enet_peer_dispatch_incoming_unreliable_commands (ENetPeer * peer, ENetChannel * { enet_list_move (enet_list_end (& peer -> dispatchedCommands), startCommand, enet_list_previous (currentCommand)); - if (! peer -> needsDispatch) + if (! (peer -> flags & ENET_PEER_FLAG_NEEDS_DISPATCH)) { enet_list_insert (enet_list_end (& peer -> host -> dispatchQueue), & peer -> dispatchList); - peer -> needsDispatch = 1; + peer -> flags |= ENET_PEER_FLAG_NEEDS_DISPATCH; } droppedCommand = currentCommand; @@ -752,11 +755,11 @@ enet_peer_dispatch_incoming_unreliable_commands (ENetPeer * peer, ENetChannel * { enet_list_move (enet_list_end (& peer -> dispatchedCommands), startCommand, enet_list_previous (currentCommand)); - if (! peer -> needsDispatch) + if (! (peer -> flags & ENET_PEER_FLAG_NEEDS_DISPATCH)) { enet_list_insert (enet_list_end (& peer -> host -> dispatchQueue), & peer -> dispatchList); - peer -> needsDispatch = 1; + peer -> flags |= ENET_PEER_FLAG_NEEDS_DISPATCH; } } } @@ -768,11 +771,11 @@ enet_peer_dispatch_incoming_unreliable_commands (ENetPeer * peer, ENetChannel * { enet_list_move (enet_list_end (& peer -> dispatchedCommands), startCommand, enet_list_previous (currentCommand)); - if (! peer -> needsDispatch) + if (! (peer -> flags & ENET_PEER_FLAG_NEEDS_DISPATCH)) { enet_list_insert (enet_list_end (& peer -> host -> dispatchQueue), & peer -> dispatchList); - peer -> needsDispatch = 1; + peer -> flags |= ENET_PEER_FLAG_NEEDS_DISPATCH; } droppedCommand = currentCommand; @@ -809,11 +812,11 @@ enet_peer_dispatch_incoming_reliable_commands (ENetPeer * peer, ENetChannel * ch enet_list_move (enet_list_end (& peer -> dispatchedCommands), enet_list_begin (& channel -> incomingReliableCommands), enet_list_previous (currentCommand)); - if (! peer -> needsDispatch) + if (! (peer -> flags & ENET_PEER_FLAG_NEEDS_DISPATCH)) { enet_list_insert (enet_list_end (& peer -> host -> dispatchQueue), & peer -> dispatchList); - peer -> needsDispatch = 1; + peer -> flags |= ENET_PEER_FLAG_NEEDS_DISPATCH; } if (! enet_list_empty (& channel -> incomingUnreliableCommands)) -- cgit v1.2.3