diff options
author | Marc Laukien <marc@zeroc.com> | 2004-10-21 18:58:04 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2004-10-21 18:58:04 +0000 |
commit | 80d153dcde86a890fc63c147ac47dabb6af91570 (patch) | |
tree | e5eb53835dda09f97c8b04eb294792bb56b6f4e4 /cpp/src | |
parent | demo build.xml now use Ice.jar (and db.jar if present), which is more (diff) | |
download | ice-80d153dcde86a890fc63c147ac47dabb6af91570.tar.bz2 ice-80d153dcde86a890fc63c147ac47dabb6af91570.tar.xz ice-80d153dcde86a890fc63c147ac47dabb6af91570.zip |
timeout for clientProxy / ice_connection
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Glacier2/RequestQueue.cpp | 2 | ||||
-rw-r--r-- | cpp/src/Ice/ConnectionI.cpp | 12 | ||||
-rw-r--r-- | cpp/src/Ice/ConnectionI.h | 2 | ||||
-rw-r--r-- | cpp/src/Ice/Proxy.cpp | 10 | ||||
-rw-r--r-- | cpp/src/Ice/RouterInfo.cpp | 18 |
5 files changed, 31 insertions, 13 deletions
diff --git a/cpp/src/Glacier2/RequestQueue.cpp b/cpp/src/Glacier2/RequestQueue.cpp index 9482807770f..37fa1cad385 100644 --- a/cpp/src/Glacier2/RequestQueue.cpp +++ b/cpp/src/Glacier2/RequestQueue.cpp @@ -234,7 +234,7 @@ Glacier2::RequestQueue::run() if(proxy->ice_batchOneway() || proxy->ice_batchDatagram()) { - flushSet.insert(proxy->ice_getConnection()); + flushSet.insert(proxy->ice_connection()); } if(_traceLevelRequest >= 1) diff --git a/cpp/src/Ice/ConnectionI.cpp b/cpp/src/Ice/ConnectionI.cpp index 325db799660..fa5672e47a1 100644 --- a/cpp/src/Ice/ConnectionI.cpp +++ b/cpp/src/Ice/ConnectionI.cpp @@ -1013,12 +1013,6 @@ Ice::ConnectionI::sendNoResponse() } } -int -Ice::ConnectionI::timeout() const -{ - return _endpoint->timeout(); // No mutex protection necessary, _endpoint is immutable. -} - EndpointPtr Ice::ConnectionI::endpoint() const { @@ -1476,6 +1470,12 @@ Ice::ConnectionI::type() const return _type; // No mutex lock, _type is immutable. } +Ice::Int +Ice::ConnectionI::timeout() const +{ + return _endpoint->timeout(); // No mutex lock, _endpoint is immutable. +} + string Ice::ConnectionI::toString() const { diff --git a/cpp/src/Ice/ConnectionI.h b/cpp/src/Ice/ConnectionI.h index b1bdcb14b76..66467c8ac72 100644 --- a/cpp/src/Ice/ConnectionI.h +++ b/cpp/src/Ice/ConnectionI.h @@ -72,7 +72,6 @@ public: void sendResponse(IceInternal::BasicStream*, Byte); void sendNoResponse(); - int timeout() const; IceInternal::EndpointPtr endpoint() const; void setAdapter(const ObjectAdapterPtr&); @@ -89,6 +88,7 @@ public: virtual void finished(const IceInternal::ThreadPoolPtr&); virtual void exception(const LocalException&); virtual std::string type() const; // From Connection. + virtual Ice::Int timeout() const; // From Connection. virtual std::string toString() const; // From Connection and EvantHandler. // diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp index d516ccecf54..99fdf23b5d4 100644 --- a/cpp/src/Ice/Proxy.cpp +++ b/cpp/src/Ice/Proxy.cpp @@ -21,7 +21,7 @@ #include <Ice/LocatorInfo.h> #include <Ice/BasicStream.h> #include <Ice/LocalException.h> -#include <Ice/ConnectionI.h> // To convert from ConnectionIPtr to ConnectionPtr in ice_getConnection(). +#include <Ice/ConnectionI.h> // To convert from ConnectionIPtr to ConnectionPtr in ice_connection(). #include <Ice/Stream.h> using namespace std; @@ -565,7 +565,7 @@ IceProxy::Ice::Object::ice_default() const } ConnectionPtr -IceProxy::Ice::Object::ice_getConnection() +IceProxy::Ice::Object::ice_connection() { int __cnt = 0; while(true) @@ -573,7 +573,7 @@ IceProxy::Ice::Object::ice_getConnection() try { Handle< ::IceDelegate::Ice::Object> __del = __getDelegate(); - return __del->ice_getConnection(); + return __del->ice_connection(); } catch(const LocalException& __ex) { @@ -879,7 +879,7 @@ IceDelegateM::Ice::Object::ice_invoke(const string& operation, } ConnectionPtr -IceDelegateM::Ice::Object::ice_getConnection() +IceDelegateM::Ice::Object::ice_connection() { return __connection; } @@ -983,7 +983,7 @@ IceDelegateD::Ice::Object::ice_invoke(const string&, } ConnectionPtr -IceDelegateD::Ice::Object::ice_getConnection() +IceDelegateD::Ice::Object::ice_connection() { throw CollocationOptimizationException(__FILE__, __LINE__); } diff --git a/cpp/src/Ice/RouterInfo.cpp b/cpp/src/Ice/RouterInfo.cpp index 41c3f3b4892..6ac35188cc3 100644 --- a/cpp/src/Ice/RouterInfo.cpp +++ b/cpp/src/Ice/RouterInfo.cpp @@ -11,6 +11,7 @@ #include <Ice/Router.h> #include <Ice/RoutingTable.h> #include <Ice/LocalException.h> +#include <Ice/Connection.h> // For ice_connection()->timeout(). #include <Ice/Functional.h> using namespace std; @@ -135,7 +136,15 @@ IceInternal::RouterInfo::getClientProxy() { throw NoEndpointException(__FILE__, __LINE__); } + _clientProxy = _clientProxy->ice_router(0); // The client proxy cannot be routed. + + // + // In order to avoid creating a new connection to the router, + // we must use the same timeout as the already existing + // connection. + // + _clientProxy = _clientProxy->ice_timeout(_router->ice_connection()->timeout()); } return _clientProxy; @@ -145,7 +154,14 @@ void IceInternal::RouterInfo::setClientProxy(const ObjectPrx& clientProxy) { IceUtil::Mutex::Lock sync(*this); + _clientProxy = clientProxy->ice_router(0); // The client proxy cannot be routed. + + // + // In order to avoid creating a new connection to the router, we + // must use the same timeout as the already existing connection. + // + _clientProxy = _clientProxy->ice_timeout(_router->ice_connection()->timeout()); } ObjectPrx @@ -160,6 +176,7 @@ IceInternal::RouterInfo::getServerProxy() { throw NoEndpointException(__FILE__, __LINE__); } + _serverProxy = _serverProxy->ice_router(0); // The server proxy cannot be routed. } @@ -170,6 +187,7 @@ void IceInternal::RouterInfo::setServerProxy(const ObjectPrx& serverProxy) { IceUtil::Mutex::Lock sync(*this); + _serverProxy = serverProxy->ice_router(0); // The server proxy cannot be routed. } |