1
0

Rewritten SocketThreads for proper shutdown scenario.

This fixes #560 and #390.
This commit is contained in:
madmaxoft
2014-01-19 19:31:43 +01:00
parent cce063b0cd
commit 3c0e8c8da0
8 changed files with 189 additions and 178 deletions

View File

@@ -87,6 +87,25 @@ void cSocket::CloseSocket()
void cSocket::ShutdownReadWrite(void)
{
#ifdef _WIN32
int res = shutdown(m_Socket, SD_BOTH);
#else
int res = shutdown(m_Socket, SHUT_RDWR);
#endif
if (res != 0)
{
LOGWARN("%s: Error shutting down socket %d (%s): %d (%s)",
__FUNCTION__, m_Socket, m_IPString.c_str(), this->GetLastError(), GetLastErrorString().c_str()
);
}
}
AString cSocket::GetErrorString( int a_ErrNo )
{
char buffer[ 1024 ];