diff options
author | LogicParrot <LogicParrot@users.noreply.github.com> | 2017-09-08 15:39:40 +0200 |
---|---|---|
committer | LogicParrot <LogicParrot@users.noreply.github.com> | 2017-09-08 15:39:40 +0200 |
commit | 9ab5627a393a0b178f13fbba2c39463cfe0675b8 (patch) | |
tree | 1f89501893f02a6e711e5a31868a8acdb4ca7de5 /src/ClientHandle.cpp | |
parent | d (diff) | |
parent | Shutdown connection when disconnect packet sent (#3999) (diff) | |
download | cuberite-9ab5627a393a0b178f13fbba2c39463cfe0675b8.tar cuberite-9ab5627a393a0b178f13fbba2c39463cfe0675b8.tar.gz cuberite-9ab5627a393a0b178f13fbba2c39463cfe0675b8.tar.bz2 cuberite-9ab5627a393a0b178f13fbba2c39463cfe0675b8.tar.lz cuberite-9ab5627a393a0b178f13fbba2c39463cfe0675b8.tar.xz cuberite-9ab5627a393a0b178f13fbba2c39463cfe0675b8.tar.zst cuberite-9ab5627a393a0b178f13fbba2c39463cfe0675b8.zip |
Diffstat (limited to 'src/ClientHandle.cpp')
-rw-r--r-- | src/ClientHandle.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index a06650d89..7aa613f4c 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -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(); } - - - - |