From cda6791496e0a41e1a8fb7fd7b9364973cd49c6e Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Mon, 10 Sep 2001 23:52:57 +0000 Subject: [PATCH] we must call shutdown in addition to close on Linux --- src/ca/tcpiiu.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ca/tcpiiu.cpp b/src/ca/tcpiiu.cpp index d47134747..638e9836e 100644 --- a/src/ca/tcpiiu.cpp +++ b/src/ca/tcpiiu.cpp @@ -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) );