diff options
author | Anthony Neal <aneal@zeroc.com> | 2001-11-30 19:58:47 +0000 |
---|---|---|
committer | Anthony Neal <aneal@zeroc.com> | 2001-11-30 19:58:47 +0000 |
commit | 0943a96869b83130fb7f2c3983a918a0dbad144b (patch) | |
tree | 45203542428d3f0776f88e98733eb1ad47dbabbc /cpp/src/Ice/SslConnectionOpenSSLServer.cpp | |
parent | converted some stuff to use Application.h (diff) | |
download | ice-0943a96869b83130fb7f2c3983a918a0dbad144b.tar.bz2 ice-0943a96869b83130fb7f2c3983a918a0dbad144b.tar.xz ice-0943a96869b83130fb7f2c3983a918a0dbad144b.zip |
Have fixed the handshake problem, now handshakes take place in the
read/write methods. As well, I have changed the configuration
properties to be under the Ice.Security.* branch of properties. I have
added a new configuration property having to do with the timeout value
for the first read after the handshake has completed - the default
value should be sufficient, but in case it is not, this is a tweak that
is avaliable.
Diffstat (limited to 'cpp/src/Ice/SslConnectionOpenSSLServer.cpp')
-rw-r--r-- | cpp/src/Ice/SslConnectionOpenSSLServer.cpp | 61 |
1 files changed, 37 insertions, 24 deletions
diff --git a/cpp/src/Ice/SslConnectionOpenSSLServer.cpp b/cpp/src/Ice/SslConnectionOpenSSLServer.cpp index 35547fa3a2c..f2244f85455 100644 --- a/cpp/src/Ice/SslConnectionOpenSSLServer.cpp +++ b/cpp/src/Ice/SslConnectionOpenSSLServer.cpp @@ -82,35 +82,50 @@ IceSecurity::Ssl::OpenSSL::ServerConnection::init(int timeout) { JTCSyncT<JTCMutex> sync(_initMutex); - int retCode = 0; + ICE_METHOD_INV("OpenSSL::ServerConnection::init()");
+
+ if (_timeoutEncountered)
+ {
+ throw TimeoutException(__FILE__, __LINE__);
+ }
+
+ int retCode = SSL_is_init_finished(_sslConnection); - ICE_METHOD_INV("OpenSSL::ServerConnection::init()"); - - if (!SSL_is_init_finished(_sslConnection)) + while (!retCode) { int i = 0; - if (initWantRead) - { - i = readSelect(timeout); - } - else if (initWantWrite) - { - i = writeSelect(timeout); - } - - if (initWantRead && i == 0) + _readTimeout = timeout;
+
+ try
+ {
+ if (_initWantRead)
+ {
+ i = readSelect(timeout);
+ }
+ else if (_initWantWrite)
+ {
+ i = writeSelect(timeout);
+ }
+ }
+ catch (const TimeoutException&)
+ {
+ _timeoutEncountered = true;
+ throw;
+ }
+
+ if (_initWantRead && i == 0) { return 0; } - if (initWantWrite && i == 0) + if (_initWantWrite && i == 0) { return 0; } - initWantRead = 0; - initWantWrite = 0; + _initWantRead = 0; + _initWantWrite = 0; int result = accept(); @@ -150,13 +165,13 @@ IceSecurity::Ssl::OpenSSL::ServerConnection::init(int timeout) { case SSL_ERROR_WANT_READ: { - initWantRead = 1; + _initWantRead = 1; break; } case SSL_ERROR_WANT_WRITE: { - initWantWrite = 1; + _initWantWrite = 1; break; } @@ -231,14 +246,12 @@ IceSecurity::Ssl::OpenSSL::ServerConnection::init(int timeout) if (retCode > 0) { + _readTimeout = timeout > _handshakeReadTimeout ? timeout : _handshakeReadTimeout;
+
// Init finished, look at the connection information. showConnectionInfo(); } } - else - { - retCode = 1; - } ICE_METHOD_RET("OpenSSL::ServerConnection::init()"); @@ -283,7 +296,7 @@ IceSecurity::Ssl::OpenSSL::ServerConnection::write(Buffer& buf, int timeout) int totalBytesWritten = 0; int bytesWritten = 0; - int packetSize = buf.b.end() - buf.i; + int packetSize = buf.b.end() - buf.i;
#ifdef WIN32 // |