diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-02-03 22:25:42 +0100 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-02-03 22:25:42 +0100 |
commit | a3759c1462fd2fe89a545fc9ece90559b4a2469a (patch) | |
tree | dc46c925aec3e28fdb610f55245377453e67fa73 /src/OSSupport | |
parent | Fixed #626 (diff) | |
parent | Merge pull request #623 from mc-server/tnt (diff) | |
download | cuberite-a3759c1462fd2fe89a545fc9ece90559b4a2469a.tar cuberite-a3759c1462fd2fe89a545fc9ece90559b4a2469a.tar.gz cuberite-a3759c1462fd2fe89a545fc9ece90559b4a2469a.tar.bz2 cuberite-a3759c1462fd2fe89a545fc9ece90559b4a2469a.tar.lz cuberite-a3759c1462fd2fe89a545fc9ece90559b4a2469a.tar.xz cuberite-a3759c1462fd2fe89a545fc9ece90559b4a2469a.tar.zst cuberite-a3759c1462fd2fe89a545fc9ece90559b4a2469a.zip |
Diffstat (limited to 'src/OSSupport')
-rw-r--r-- | src/OSSupport/SocketThreads.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/OSSupport/SocketThreads.cpp b/src/OSSupport/SocketThreads.cpp index 3e2631733..a02661d2c 100644 --- a/src/OSSupport/SocketThreads.cpp +++ b/src/OSSupport/SocketThreads.cpp @@ -209,6 +209,10 @@ bool cSocketThreads::cSocketThread::RemoveClient(const cCallback * a_Client) if (m_Slots[i].m_State == sSlot::ssRemoteClosed) { // The remote has already closed the socket, remove the slot altogether: + if (m_Slots[i].m_Socket.IsValid()) + { + m_Slots[i].m_Socket.CloseSocket(); + } m_Slots[i] = m_Slots[--m_NumSlots]; } else @@ -489,6 +493,7 @@ void cSocketThreads::cSocketThread::ReadFromSockets(fd_set * a_Read) // Notify the callback that the remote has closed the socket; keep the slot m_Slots[i].m_Client->SocketClosed(); m_Slots[i].m_State = sSlot::ssRemoteClosed; + m_Slots[i].m_Socket.CloseSocket(); break; } case sSlot::ssWritingRestOut: @@ -557,6 +562,11 @@ void cSocketThreads::cSocketThread::WriteToSockets(fd_set * a_Write) } } // if (outgoing data is empty) + if (m_Slots[i].m_State == sSlot::ssRemoteClosed) + { + continue; + } + if (!SendDataThroughSocket(m_Slots[i].m_Socket, m_Slots[i].m_Outgoing)) { int Err = cSocket::GetLastError(); @@ -566,7 +576,7 @@ void cSocketThreads::cSocketThread::WriteToSockets(fd_set * a_Write) { m_Slots[i].m_Client->SocketClosed(); } - return; + continue; } if (m_Slots[i].m_Outgoing.empty() && (m_Slots[i].m_State == sSlot::ssWritingRestOut)) |