summaryrefslogtreecommitdiffstats
path: root/src/OSSupport
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-02-03 17:07:46 +0100
committermadmaxoft <github@xoft.cz>2014-02-03 17:07:46 +0100
commitc9916cd8c2332b6d6992ab38c0339ced6c91bc92 (patch)
treeb38cb3e858d655b57a84034f6b2eac87ee9b2bd8 /src/OSSupport
parentSocketThreads: Fixed sending to closed socket. (diff)
downloadcuberite-c9916cd8c2332b6d6992ab38c0339ced6c91bc92.tar
cuberite-c9916cd8c2332b6d6992ab38c0339ced6c91bc92.tar.gz
cuberite-c9916cd8c2332b6d6992ab38c0339ced6c91bc92.tar.bz2
cuberite-c9916cd8c2332b6d6992ab38c0339ced6c91bc92.tar.lz
cuberite-c9916cd8c2332b6d6992ab38c0339ced6c91bc92.tar.xz
cuberite-c9916cd8c2332b6d6992ab38c0339ced6c91bc92.tar.zst
cuberite-c9916cd8c2332b6d6992ab38c0339ced6c91bc92.zip
Diffstat (limited to 'src/OSSupport')
-rw-r--r--src/OSSupport/SocketThreads.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/OSSupport/SocketThreads.cpp b/src/OSSupport/SocketThreads.cpp
index 269f1d452..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: