diff options
author | Benoit Foucher <benoit@zeroc.com> | 2005-01-26 10:32:22 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2005-01-26 10:32:22 +0000 |
commit | aad3601a839fa51dea71d26d5c1e5d129d9854bb (patch) | |
tree | e1b6efad853ad7a2d30a51d631ef669466c4ce02 /cpp/src | |
parent | Fixed bug where the transceiver wouldn't be closed if the thread pool (diff) | |
download | ice-aad3601a839fa51dea71d26d5c1e5d129d9854bb.tar.bz2 ice-aad3601a839fa51dea71d26d5c1e5d129d9854bb.tar.xz ice-aad3601a839fa51dea71d26d5c1e5d129d9854bb.zip |
Connection validation now checks for Ice.Override.ConnectTimeout and raise
Ice::ConnectTimeoutException if the validation times out.
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Ice/ConnectionI.cpp | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/cpp/src/Ice/ConnectionI.cpp b/cpp/src/Ice/ConnectionI.cpp index 915e1b4be49..d81fe1a81a0 100644 --- a/cpp/src/Ice/ConnectionI.cpp +++ b/cpp/src/Ice/ConnectionI.cpp @@ -12,6 +12,7 @@ #include <Ice/LoggerUtil.h> #include <Ice/Properties.h> #include <Ice/TraceUtil.h> +#include <Ice/DefaultsAndOverrides.h> #include <Ice/Transceiver.h> #include <Ice/ThreadPool.h> #include <Ice/ConnectionMonitor.h> @@ -67,6 +68,16 @@ Ice::ConnectionI::validate() { try { + Int timeout; + if(_instance->defaultsAndOverrides()->overrideConnectTimeout) + { + timeout = _instance->defaultsAndOverrides()->overrideConnectTimeoutValue; + } + else + { + timeout = _endpoint->timeout(); + } + if(_adapter) { IceUtil::Mutex::Lock sendSync(_sendMutex); @@ -86,7 +97,14 @@ Ice::ConnectionI::validate() os.write(headerSize); // Message size. os.i = os.b.begin(); traceHeader("sending validate connection", os, _logger, _traceLevels); - _transceiver->write(os, _endpoint->timeout()); + try + { + _transceiver->write(os, timeout); + } + catch(const TimeoutException&) + { + throw ConnectTimeoutException(__FILE__, __LINE__); + } } else { @@ -97,7 +115,14 @@ Ice::ConnectionI::validate() BasicStream is(_instance.get()); is.b.resize(headerSize); is.i = is.b.begin(); - _transceiver->read(is, _endpoint->timeout()); + try + { + _transceiver->read(is, timeout); + } + catch(const TimeoutException&) + { + throw ConnectTimeoutException(__FILE__, __LINE__); + } assert(is.i == is.b.end()); is.i = is.b.begin(); ByteSeq m(sizeof(magic), 0); |