1
0

Fixed socket leaking.

This commit is contained in:
madmaxoft 2014-02-03 17:07:46 +01:00
parent 0b384198e5
commit c9916cd8c2

View File

@ -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: