mirror of
https://github.com/lsalzman/enet
synced 2024-11-21 06:25:59 -07:00
update totalWaitingData when removing an incoming command
This commit is contained in:
parent
0b924c79ce
commit
a52811ef27
1 changed files with 13 additions and 11 deletions
24
peer.c
24
peer.c
|
@ -255,7 +255,7 @@ enet_peer_receive (ENetPeer * peer, enet_uint8 * channelID)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
enet_peer_reset_outgoing_commands (ENetList * queue)
|
enet_peer_reset_outgoing_commands (ENetPeer * peer, ENetList * queue)
|
||||||
{
|
{
|
||||||
ENetOutgoingCommand * outgoingCommand;
|
ENetOutgoingCommand * outgoingCommand;
|
||||||
|
|
||||||
|
@ -276,7 +276,7 @@ enet_peer_reset_outgoing_commands (ENetList * queue)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
enet_peer_remove_incoming_commands (ENetList * queue, ENetListIterator startCommand, ENetListIterator endCommand, ENetIncomingCommand * excludeCommand)
|
enet_peer_remove_incoming_commands (ENetPeer * peer, ENetList * queue, ENetListIterator startCommand, ENetListIterator endCommand, ENetIncomingCommand * excludeCommand)
|
||||||
{
|
{
|
||||||
ENetListIterator currentCommand;
|
ENetListIterator currentCommand;
|
||||||
|
|
||||||
|
@ -295,6 +295,8 @@ enet_peer_remove_incoming_commands (ENetList * queue, ENetListIterator startComm
|
||||||
{
|
{
|
||||||
-- incomingCommand -> packet -> referenceCount;
|
-- incomingCommand -> packet -> referenceCount;
|
||||||
|
|
||||||
|
peer -> totalWaitingData -= incomingCommand -> packet -> dataLength;
|
||||||
|
|
||||||
if (incomingCommand -> packet -> referenceCount == 0)
|
if (incomingCommand -> packet -> referenceCount == 0)
|
||||||
enet_packet_destroy (incomingCommand -> packet);
|
enet_packet_destroy (incomingCommand -> packet);
|
||||||
}
|
}
|
||||||
|
@ -307,9 +309,9 @@ enet_peer_remove_incoming_commands (ENetList * queue, ENetListIterator startComm
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
enet_peer_reset_incoming_commands (ENetList * queue)
|
enet_peer_reset_incoming_commands (ENetPeer * peer, ENetList * queue)
|
||||||
{
|
{
|
||||||
enet_peer_remove_incoming_commands(queue, enet_list_begin (queue), enet_list_end (queue), NULL);
|
enet_peer_remove_incoming_commands(peer, queue, enet_list_begin (queue), enet_list_end (queue), NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -327,10 +329,10 @@ enet_peer_reset_queues (ENetPeer * peer)
|
||||||
while (! enet_list_empty (& peer -> acknowledgements))
|
while (! enet_list_empty (& peer -> acknowledgements))
|
||||||
enet_free (enet_list_remove (enet_list_begin (& peer -> acknowledgements)));
|
enet_free (enet_list_remove (enet_list_begin (& peer -> acknowledgements)));
|
||||||
|
|
||||||
enet_peer_reset_outgoing_commands (& peer -> sentReliableCommands);
|
enet_peer_reset_outgoing_commands (peer, & peer -> sentReliableCommands);
|
||||||
enet_peer_reset_outgoing_commands (& peer -> outgoingCommands);
|
enet_peer_reset_outgoing_commands (peer, & peer -> outgoingCommands);
|
||||||
enet_peer_reset_outgoing_commands (& peer -> outgoingSendReliableCommands);
|
enet_peer_reset_outgoing_commands (peer, & peer -> outgoingSendReliableCommands);
|
||||||
enet_peer_reset_incoming_commands (& peer -> dispatchedCommands);
|
enet_peer_reset_incoming_commands (peer, & peer -> dispatchedCommands);
|
||||||
|
|
||||||
if (peer -> channels != NULL && peer -> channelCount > 0)
|
if (peer -> channels != NULL && peer -> channelCount > 0)
|
||||||
{
|
{
|
||||||
|
@ -338,8 +340,8 @@ enet_peer_reset_queues (ENetPeer * peer)
|
||||||
channel < & peer -> channels [peer -> channelCount];
|
channel < & peer -> channels [peer -> channelCount];
|
||||||
++ channel)
|
++ channel)
|
||||||
{
|
{
|
||||||
enet_peer_reset_incoming_commands (& channel -> incomingReliableCommands);
|
enet_peer_reset_incoming_commands (peer, & channel -> incomingReliableCommands);
|
||||||
enet_peer_reset_incoming_commands (& channel -> incomingUnreliableCommands);
|
enet_peer_reset_incoming_commands (peer, & channel -> incomingUnreliableCommands);
|
||||||
}
|
}
|
||||||
|
|
||||||
enet_free (peer -> channels);
|
enet_free (peer -> channels);
|
||||||
|
@ -801,7 +803,7 @@ enet_peer_dispatch_incoming_unreliable_commands (ENetPeer * peer, ENetChannel *
|
||||||
droppedCommand = currentCommand;
|
droppedCommand = currentCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
enet_peer_remove_incoming_commands (& channel -> incomingUnreliableCommands, enet_list_begin (& channel -> incomingUnreliableCommands), droppedCommand, queuedCommand);
|
enet_peer_remove_incoming_commands (peer, & channel -> incomingUnreliableCommands, enet_list_begin (& channel -> incomingUnreliableCommands), droppedCommand, queuedCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue