1
0

Shutdown connection when disconnect packet sent (#3999)

This commit is contained in:
Alexander Harkness
2017-09-08 08:36:23 +01:00
committed by Mattes D
parent b12f4ef7d5
commit c334824199
2 changed files with 11 additions and 11 deletions

View File

@@ -2087,6 +2087,12 @@ void cClientHandle::Tick(float a_Dt)
return;
}
// If player has been kicked, terminate the connection:
if (m_State == csKicked)
{
m_Link->Shutdown();
}
// If destruction is queued, destroy now:
if (m_State == csQueuedForDestruction)
{
@@ -2515,6 +2521,10 @@ void cClientHandle::SendDisconnect(const AString & a_Reason)
LOGD("Sending a DC: \"%s\"", StripColorCodes(a_Reason).c_str());
m_Protocol->SendDisconnect(a_Reason);
m_HasSentDC = true;
// csKicked means m_Link will be shut down on the next tick. The
// disconnect packet data is sent in the tick thread so the connection
// is closed there after the data is sent.
m_State = csKicked;
}
}
@@ -3389,7 +3399,3 @@ void cClientHandle::OnError(int a_ErrorCode, const AString & a_ErrorMsg)
}
SocketClosed();
}