diff options
Diffstat (limited to 'cpp/src/IceSSL/SslTransceiver.cpp')
-rw-r--r-- | cpp/src/IceSSL/SslTransceiver.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/cpp/src/IceSSL/SslTransceiver.cpp b/cpp/src/IceSSL/SslTransceiver.cpp index ebf5508e280..64dc4b002d7 100644 --- a/cpp/src/IceSSL/SslTransceiver.cpp +++ b/cpp/src/IceSSL/SslTransceiver.cpp @@ -40,7 +40,17 @@ IceSSL::SslTransceiver::close() SOCKET fd = _fd; _fd = INVALID_SOCKET; - _sslConnection->shutdown(); + + int shutdown = 0; + int numRetries = 100; + int retries = -numRetries; + do + { + shutdown = _sslConnection->shutdown(); + retries++; + } + while ((shutdown == 0) && (retries < 0)); + ::shutdown(fd, SHUT_RDWR); // helps to unblock threads in recv() closeSocket(fd); } @@ -55,7 +65,16 @@ IceSSL::SslTransceiver::shutdown() _logger->trace(_traceLevels->networkCat, s.str()); } - _sslConnection->shutdown(); + int shutdown = 0; + int numRetries = 100; + int retries = -numRetries; + do + { + shutdown = _sslConnection->shutdown(); + retries++; + } + while ((shutdown == 0) && (retries < 0)); + ::shutdown(_fd, SHUT_WR); // Shutdown socket for writing } |