diff options
Diffstat (limited to 'cpp/src/Ice/SslConnectionOpenSSL.cpp')
-rw-r--r-- | cpp/src/Ice/SslConnectionOpenSSL.cpp | 52 |
1 files changed, 27 insertions, 25 deletions
diff --git a/cpp/src/Ice/SslConnectionOpenSSL.cpp b/cpp/src/Ice/SslConnectionOpenSSL.cpp index 74a859f4a5e..132429375a9 100644 --- a/cpp/src/Ice/SslConnectionOpenSSL.cpp +++ b/cpp/src/Ice/SslConnectionOpenSSL.cpp @@ -423,7 +423,6 @@ IceSSL::OpenSSL::Connection::read(Buffer& buf, int timeout) { int packetSize = buf.b.end() - buf.i; int totalBytesRead = 0; - int bytesPending; int bytesRead; int initReturn = 0; @@ -446,28 +445,22 @@ IceSSL::OpenSSL::Connection::read(Buffer& buf, int timeout) continue; } - // initReturn must be > 0, so we're okay to try a read - - bytesPending = pending(); - - if (!bytesPending && readSelect(_readTimeout)) - { - bytesPending = 1; - } - - _readTimeout = timeout; - - if (!bytesPending) - { - if (_traceLevels->security >= IceSSL::SECURITY_PROTOCOL) - { - _logger->trace(_traceLevels->securityCat, "no pending application-level bytes"); - } - - // We're done here. - break; - } - + // initReturn must be > 0, so we're okay to try a read
+
+ if (!pending() && !readSelect(_readTimeout))
+ {
+ // Nothing is left to read (according to SSL).
+ if (_traceLevels->security >= IceSSL::SECURITY_PROTOCOL)
+ {
+ _logger->trace(_traceLevels->securityCat, "no pending application-level bytes");
+ }
+
+ // We're done here.
+ break;
+ }
+
+ _readTimeout = timeout;
+
bytesRead = sslRead((char *)buf.i, packetSize); switch (getLastError()) @@ -496,8 +489,17 @@ IceSSL::OpenSSL::Connection::read(Buffer& buf, int timeout) continue; } - case SSL_ERROR_WANT_WRITE: - case SSL_ERROR_WANT_READ: + case SSL_ERROR_WANT_READ:
+ {
+ if (!readSelect(timeout))
+ {
+ // Timeout and wait for them to arrive.
+ throw TimeoutException(__FILE__, __LINE__);
+ }
+ continue;
+ } +
+ case SSL_ERROR_WANT_WRITE:
case SSL_ERROR_WANT_X509_LOOKUP: { // Perform another read. The read should take care of this. |