mirror of
https://github.com/lsalzman/enet
synced 2024-11-21 14:29:05 -07:00
delay handling of DISCONNECT_LATER until in-flight unreliable packets are sent
This commit is contained in:
parent
e2ef83927d
commit
b8713bdf88
1 changed files with 13 additions and 3 deletions
16
protocol.c
16
protocol.c
|
@ -163,7 +163,10 @@ enet_protocol_remove_sent_unreliable_commands (ENetPeer * peer)
|
||||||
{
|
{
|
||||||
ENetOutgoingCommand * outgoingCommand;
|
ENetOutgoingCommand * outgoingCommand;
|
||||||
|
|
||||||
while (! enet_list_empty (& peer -> sentUnreliableCommands))
|
if (enet_list_empty (& peer -> sentUnreliableCommands))
|
||||||
|
return;
|
||||||
|
|
||||||
|
do
|
||||||
{
|
{
|
||||||
outgoingCommand = (ENetOutgoingCommand *) enet_list_front (& peer -> sentUnreliableCommands);
|
outgoingCommand = (ENetOutgoingCommand *) enet_list_front (& peer -> sentUnreliableCommands);
|
||||||
|
|
||||||
|
@ -182,7 +185,13 @@ enet_protocol_remove_sent_unreliable_commands (ENetPeer * peer)
|
||||||
}
|
}
|
||||||
|
|
||||||
enet_free (outgoingCommand);
|
enet_free (outgoingCommand);
|
||||||
}
|
} while (! enet_list_empty (& peer -> sentUnreliableCommands));
|
||||||
|
|
||||||
|
if (peer -> state == ENET_PEER_STATE_DISCONNECT_LATER &&
|
||||||
|
enet_list_empty (& peer -> outgoingReliableCommands) &&
|
||||||
|
enet_list_empty (& peer -> outgoingUnreliableCommands) &&
|
||||||
|
enet_list_empty (& peer -> sentReliableCommands))
|
||||||
|
enet_peer_disconnect (peer, peer -> eventData);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ENetProtocolCommand
|
static ENetProtocolCommand
|
||||||
|
@ -1406,7 +1415,8 @@ enet_protocol_send_unreliable_outgoing_commands (ENetHost * host, ENetPeer * pee
|
||||||
if (peer -> state == ENET_PEER_STATE_DISCONNECT_LATER &&
|
if (peer -> state == ENET_PEER_STATE_DISCONNECT_LATER &&
|
||||||
enet_list_empty (& peer -> outgoingReliableCommands) &&
|
enet_list_empty (& peer -> outgoingReliableCommands) &&
|
||||||
enet_list_empty (& peer -> outgoingUnreliableCommands) &&
|
enet_list_empty (& peer -> outgoingUnreliableCommands) &&
|
||||||
enet_list_empty (& peer -> sentReliableCommands))
|
enet_list_empty (& peer -> sentReliableCommands) &&
|
||||||
|
enet_list_empty (& peer -> sentUnreliableCommands))
|
||||||
enet_peer_disconnect (peer, peer -> eventData);
|
enet_peer_disconnect (peer, peer -> eventData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue