Network/ENetPeer: Fix DisconnectLater not waiting for pending commands

This commit is contained in:
Jérôme Leclercq 2017-01-31 15:31:11 +01:00
parent 3ff483d2f6
commit 4f1df53f07
1 changed files with 3 additions and 1 deletions

View File

@ -83,7 +83,7 @@ namespace Nz
void ENetPeer::DisconnectLater(UInt32 data)
{
if (IsConnected() && !m_outgoingReliableCommands.empty() && !m_outgoingUnreliableCommands.empty() && !m_sentReliableCommands.empty())
if (IsConnected() && HasPendingCommands())
{
m_state = ENetPeerState::DisconnectLater;
m_eventData = data;
@ -596,10 +596,12 @@ namespace Nz
Reset();
}
else
{
if (command->header.command & ENetProtocolFlag_Acknowledge)
ChangeState(ENetPeerState::AcknowledgingDisconnect);
else
DispatchState(ENetPeerState::Zombie);
}
}
if (m_state != ENetPeerState::Disconnected)