diff options
author | Benoit Foucher <benoit@zeroc.com> | 2016-12-30 14:56:35 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2016-12-30 14:56:35 +0100 |
commit | e81bb2ccbed96ae88c26550375131b0659ae587b (patch) | |
tree | 9b5ff36cc72c2f4dcbf71d70c89b46d2804324dd /cpp/src | |
parent | Fixed JS browser test failures caused by addition of Ice.Value (diff) | |
download | ice-e81bb2ccbed96ae88c26550375131b0659ae587b.tar.bz2 ice-e81bb2ccbed96ae88c26550375131b0659ae587b.tar.xz ice-e81bb2ccbed96ae88c26550375131b0659ae587b.zip |
Fixed ICE-7476 - Ice/background test failure on stretch with SSL
Diffstat (limited to 'cpp/src')
-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 863b758791d..a1e61c81535 100644 --- a/cpp/src/IceSSL/OpenSSLTransceiverI.cpp +++ b/cpp/src/IceSSL/OpenSSLTransceiverI.cpp @@ -204,44 +204,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: { @@ -389,42 +382,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: { @@ -501,43 +487,35 @@ IceSSL::TransceiverI::read(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_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: { |