we must call shutdown in addition to close on Linux

This commit is contained in:
Jeff Hill
2001-09-10 23:52:57 +00:00
parent ccd2eb30bd
commit cda6791496

View File

@@ -597,13 +597,19 @@ void tcpiiu::shutdown ( bool discardPendingMessages )
SOCKERRSTR (SOCKERRNO) );
}
}
// linux threads in recv() dont wakeup unless we also
// call shutdown ( close by itself is not enough )
int status = ::shutdown ( this->sock, SD_BOTH );
if ( status ) {
errlogPrintf ("CAC TCP socket shutdown error was %s\n",
SOCKERRSTR (SOCKERRNO) );
}
//
// on winsock and probably vxWorks shutdown() does not
// unblock a thread in recv() so we use close and introduce
// some complexity because we must unregister the fd early
//
int status = socket_close ( this->sock );
status = socket_close ( this->sock );
if ( status ) {
errlogPrintf ("CAC TCP socket close error was %s\n",
SOCKERRSTR (SOCKERRNO) );