command queuing fix

This commit is contained in:
Lee Salzman
2020-08-23 16:40:17 -04:00
parent 8d55487767
commit 259e5dbd23
2 changed files with 13 additions and 10 deletions
+2 -2
View File
@@ -593,8 +593,8 @@ extern void enet_peer_setup_outgoing_command (ENetPeer *, ENetO
extern ENetOutgoingCommand * enet_peer_queue_outgoing_command (ENetPeer *, const ENetProtocol *, ENetPacket *, enet_uint32, enet_uint16); extern ENetOutgoingCommand * enet_peer_queue_outgoing_command (ENetPeer *, const ENetProtocol *, ENetPacket *, enet_uint32, enet_uint16);
extern ENetIncomingCommand * enet_peer_queue_incoming_command (ENetPeer *, const ENetProtocol *, const void *, size_t, enet_uint32, enet_uint32); extern ENetIncomingCommand * enet_peer_queue_incoming_command (ENetPeer *, const ENetProtocol *, const void *, size_t, enet_uint32, enet_uint32);
extern ENetAcknowledgement * enet_peer_queue_acknowledgement (ENetPeer *, const ENetProtocol *, enet_uint16); extern ENetAcknowledgement * enet_peer_queue_acknowledgement (ENetPeer *, const ENetProtocol *, enet_uint16);
extern void enet_peer_dispatch_incoming_unreliable_commands (ENetPeer *, ENetChannel *); extern void enet_peer_dispatch_incoming_unreliable_commands (ENetPeer *, ENetChannel *, ENetIncomingCommand *);
extern void enet_peer_dispatch_incoming_reliable_commands (ENetPeer *, ENetChannel *); extern void enet_peer_dispatch_incoming_reliable_commands (ENetPeer *, ENetChannel *, ENetIncomingCommand *);
extern void enet_peer_on_connect (ENetPeer *); extern void enet_peer_on_connect (ENetPeer *);
extern void enet_peer_on_disconnect (ENetPeer *); extern void enet_peer_on_disconnect (ENetPeer *);
+11 -8
View File
@@ -268,7 +268,7 @@ enet_peer_reset_outgoing_commands (ENetList * queue)
} }
static void static void
enet_peer_remove_incoming_commands (ENetList * queue, ENetListIterator startCommand, ENetListIterator endCommand) enet_peer_remove_incoming_commands (ENetList * queue, ENetListIterator startCommand, ENetListIterator endCommand, ENetIncomingCommand * excludeCommand)
{ {
ENetListIterator currentCommand; ENetListIterator currentCommand;
@@ -278,6 +278,9 @@ enet_peer_remove_incoming_commands (ENetList * queue, ENetListIterator startComm
currentCommand = enet_list_next (currentCommand); currentCommand = enet_list_next (currentCommand);
if (incomingCommand == excludeCommand)
continue;
enet_list_remove (& incomingCommand -> incomingCommandList); enet_list_remove (& incomingCommand -> incomingCommandList);
if (incomingCommand -> packet != NULL) if (incomingCommand -> packet != NULL)
@@ -298,7 +301,7 @@ 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 (ENetList * queue)
{ {
enet_peer_remove_incoming_commands(queue, enet_list_begin (queue), enet_list_end (queue)); enet_peer_remove_incoming_commands(queue, enet_list_begin (queue), enet_list_end (queue), NULL);
} }
void void
@@ -697,7 +700,7 @@ enet_peer_queue_outgoing_command (ENetPeer * peer, const ENetProtocol * command,
} }
void void
enet_peer_dispatch_incoming_unreliable_commands (ENetPeer * peer, ENetChannel * channel) enet_peer_dispatch_incoming_unreliable_commands (ENetPeer * peer, ENetChannel * channel, ENetIncomingCommand * queuedCommand)
{ {
ENetListIterator droppedCommand, startCommand, currentCommand; ENetListIterator droppedCommand, startCommand, currentCommand;
@@ -776,11 +779,11 @@ 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); enet_peer_remove_incoming_commands (& channel -> incomingUnreliableCommands, enet_list_begin (& channel -> incomingUnreliableCommands), droppedCommand, queuedCommand);
} }
void void
enet_peer_dispatch_incoming_reliable_commands (ENetPeer * peer, ENetChannel * channel) enet_peer_dispatch_incoming_reliable_commands (ENetPeer * peer, ENetChannel * channel, ENetIncomingCommand * queuedCommand)
{ {
ENetListIterator currentCommand; ENetListIterator currentCommand;
@@ -815,7 +818,7 @@ enet_peer_dispatch_incoming_reliable_commands (ENetPeer * peer, ENetChannel * ch
} }
if (! enet_list_empty (& channel -> incomingUnreliableCommands)) if (! enet_list_empty (& channel -> incomingUnreliableCommands))
enet_peer_dispatch_incoming_unreliable_commands (peer, channel); enet_peer_dispatch_incoming_unreliable_commands (peer, channel, queuedCommand);
} }
ENetIncomingCommand * ENetIncomingCommand *
@@ -973,11 +976,11 @@ enet_peer_queue_incoming_command (ENetPeer * peer, const ENetProtocol * command,
{ {
case ENET_PROTOCOL_COMMAND_SEND_FRAGMENT: case ENET_PROTOCOL_COMMAND_SEND_FRAGMENT:
case ENET_PROTOCOL_COMMAND_SEND_RELIABLE: case ENET_PROTOCOL_COMMAND_SEND_RELIABLE:
enet_peer_dispatch_incoming_reliable_commands (peer, channel); enet_peer_dispatch_incoming_reliable_commands (peer, channel, incomingCommand);
break; break;
default: default:
enet_peer_dispatch_incoming_unreliable_commands (peer, channel); enet_peer_dispatch_incoming_unreliable_commands (peer, channel, incomingCommand);
break; break;
} }