diff options
author | Benoit Foucher <benoit@zeroc.com> | 2016-12-30 14:56:35 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2017-01-09 15:38:11 +0100 |
commit | 22b3129941aee83992fc0b80c059510b667e1a79 (patch) | |
tree | 9277edd1afcf8e85af6ca2236542d7b0dbfccb4a /cpp/src/IceSSL | |
parent | Bumped the Glacier2/sessionHelper timeout to 30s (diff) | |
download | ice-22b3129941aee83992fc0b80c059510b667e1a79.tar.bz2 ice-22b3129941aee83992fc0b80c059510b667e1a79.tar.xz ice-22b3129941aee83992fc0b80c059510b667e1a79.zip |
Fixed ICE-7476 - Ice/background test failure on stretch with SSL
Diffstat (limited to 'cpp/src/IceSSL')
-rw-r--r-- | cpp/src/IceSSL/OpenSSLTransceiverI.cpp | 146 |
1 files changed, 62 insertions, 84 deletions
diff --git a/cpp/src/IceSSL/OpenSSLTransceiverI.cpp b/cpp/src/IceSSL/OpenSSLTransceiverI.cpp index 9f070442a30..3b200a8fa4a 100644 --- a/cpp/src/IceSSL/OpenSSLTransceiverI.cpp +++ b/cpp/src/IceSSL/OpenSSLTransceiverI.cpp @@ -190,44 +190,37 @@ IceSSL::TransceiverI::initialize(IceInternal::Buffer& readBuffer, IceInternal::B } case SSL_ERROR_SYSCALL: { - if(ret == 0) + if(IceInternal::interrupted()) { - ConnectionLostException ex(__FILE__, __LINE__); - ex.error = 0; - throw ex; + break; } - if(ret == -1) + if(IceInternal::wouldBlock()) { - if(IceInternal::interrupted()) + if(SSL_want_read(_ssl)) { - break; + return IceInternal::SocketOperationRead; } - - if(IceInternal::wouldBlock()) + else if(SSL_want_write(_ssl)) { - if(SSL_want_read(_ssl)) - { - return IceInternal::SocketOperationRead; - } - else if(SSL_want_write(_ssl)) - { - return IceInternal::SocketOperationWrite; - } - - break; + return IceInternal::SocketOperationWrite; } - if(IceInternal::connectionLost()) - { - ConnectionLostException ex(__FILE__, __LINE__); - ex.error = IceInternal::getSocketErrno(); - throw ex; - } + break; + } + + if(IceInternal::connectionLost() || IceInternal::getSocketErrno() == 0) + { + ConnectionLostException ex(__FILE__, __LINE__); + ex.error = IceInternal::getSocketErrno(); + throw ex; + } + else + { + SocketException ex(__FILE__, __LINE__); + ex.error = IceInternal::getSocketErrno(); + throw ex; } - SocketException ex(__FILE__, __LINE__); - ex.error = IceInternal::getSocketErrno(); - throw ex; } case SSL_ERROR_SSL: { @@ -382,42 +375,35 @@ IceSSL::TransceiverI::write(IceInternal::Buffer& buf) } case SSL_ERROR_SYSCALL: { - if(ret == -1) + if(IceInternal::interrupted()) { - if(IceInternal::interrupted()) - { - continue; - } - - if(IceInternal::noBuffers() && packetSize > 1024) - { - packetSize /= 2; - continue; - } + continue; + } - if(IceInternal::wouldBlock()) - { - assert(SSL_want_write(_ssl)); - return IceInternal::SocketOperationWrite; - } + if(IceInternal::noBuffers() && packetSize > 1024) + { + packetSize /= 2; + continue; + } - if(IceInternal::connectionLost()) - { - ConnectionLostException ex(__FILE__, __LINE__); - ex.error = IceInternal::getSocketErrno(); - throw ex; - } + if(IceInternal::wouldBlock()) + { + assert(SSL_want_write(_ssl)); + return IceInternal::SocketOperationWrite; } - if(ret == 0) + + if(IceInternal::connectionLost() || IceInternal::getSocketErrno() == 0) { ConnectionLostException ex(__FILE__, __LINE__); - ex.error = 0; + ex.error = IceInternal::getSocketErrno(); + throw ex; + } + else + { + SocketException ex(__FILE__, __LINE__); + ex.error = IceInternal::getSocketErrno(); throw ex; } - - SocketException ex(__FILE__, __LINE__); - ex.error = IceInternal::getSocketErrno(); - throw ex; } case SSL_ERROR_SSL: { @@ -493,43 +479,35 @@ IceSSL::TransceiverI::read(IceInternal::Buffer& buf, bool& hasMoreData) } case SSL_ERROR_SYSCALL: { - if(ret == -1) + if(IceInternal::interrupted()) { - if(IceInternal::interrupted()) - { - continue; - } - - if(IceInternal::noBuffers() && packetSize > 1024) - { - packetSize /= 2; - continue; - } + continue; + } - if(IceInternal::wouldBlock()) - { - assert(SSL_want_read(_ssl)); - return IceInternal::SocketOperationRead; - } + if(IceInternal::noBuffers() && packetSize > 1024) + { + packetSize /= 2; + continue; + } - if(IceInternal::connectionLost()) - { - ConnectionLostException ex(__FILE__, __LINE__); - ex.error = IceInternal::getSocketErrno(); - throw ex; - } + if(IceInternal::wouldBlock()) + { + assert(SSL_want_read(_ssl)); + return IceInternal::SocketOperationRead; } - if(ret == 0) + if(IceInternal::connectionLost() || IceInternal::getSocketErrno() == 0) { ConnectionLostException ex(__FILE__, __LINE__); - ex.error = 0; + ex.error = IceInternal::getSocketErrno(); + throw ex; + } + else + { + SocketException ex(__FILE__, __LINE__); + ex.error = IceInternal::getSocketErrno(); throw ex; } - - SocketException ex(__FILE__, __LINE__); - ex.error = IceInternal::getSocketErrno(); - throw ex; } case SSL_ERROR_SSL: { |