diff options
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Glacier2/RouterI.cpp | 11 | ||||
-rw-r--r-- | cpp/src/Ice/ConnectionFactory.cpp | 3 | ||||
-rw-r--r-- | cpp/src/Ice/ObjectAdapterI.cpp | 3 | ||||
-rw-r--r-- | cpp/src/Ice/PropertyNames.cpp | 3 | ||||
-rw-r--r-- | cpp/src/Ice/PropertyNames.h | 2 | ||||
-rw-r--r-- | cpp/src/Ice/Reference.cpp | 3 | ||||
-rw-r--r-- | cpp/src/Ice/RouterInfo.cpp | 99 | ||||
-rw-r--r-- | cpp/src/Ice/RouterInfo.h | 11 |
8 files changed, 61 insertions, 74 deletions
diff --git a/cpp/src/Glacier2/RouterI.cpp b/cpp/src/Glacier2/RouterI.cpp index dadef55b63b..af1275bd627 100644 --- a/cpp/src/Glacier2/RouterI.cpp +++ b/cpp/src/Glacier2/RouterI.cpp @@ -23,7 +23,6 @@ Glacier2::RouterI::RouterI(const ObjectAdapterPtr& clientAdapter, const ObjectAd const string& userId, const SessionPrx& session, const Identity& controlId, const FilterManagerPtr& filters, const Ice::Context& sslContext) : _communicator(clientAdapter->getCommunicator()), - _clientProxy(clientAdapter->createProxy(_communicator->stringToIdentity("dummy"))), _clientBlobject(new ClientBlobject(_communicator, filters, sslContext)), _adminAdapter(adminAdapter), _connection(connection), @@ -33,6 +32,16 @@ Glacier2::RouterI::RouterI(const ObjectAdapterPtr& clientAdapter, const ObjectAd _sslContext(sslContext), _timestamp(IceUtil::Time::now()) { + // + // If Glacier2 will be used with pre 3.2 clients, then the client proxy must be set. + // Otherwise getClientProxy just needs to return a nil proxy. + // + if(_communicator->getProperties()->getPropertyAsInt("Glacier2.ReturnClientProxy") > 0) + { + const_cast<Ice::ObjectPrx&>(_clientProxy) = + clientAdapter->createProxy(_communicator->stringToIdentity("dummy")); + } + if(serverAdapter) { ObjectPrx& serverProxy = const_cast<ObjectPrx&>(_serverProxy); diff --git a/cpp/src/Ice/ConnectionFactory.cpp b/cpp/src/Ice/ConnectionFactory.cpp index 55a01678fd9..1bae93eddb9 100644 --- a/cpp/src/Ice/ConnectionFactory.cpp +++ b/cpp/src/Ice/ConnectionFactory.cpp @@ -390,9 +390,8 @@ IceInternal::OutgoingConnectionFactory::setRouterInfo(const RouterInfoPtr& route // callbacks from the router can be received over such // connections. // - ObjectPrx proxy = routerInfo->getClientProxy(); ObjectAdapterPtr adapter = routerInfo->getAdapter(); - vector<EndpointIPtr> endpoints = proxy->__reference()->getEndpoints(); + vector<EndpointIPtr> endpoints = routerInfo->getClientEndpoints(); vector<EndpointIPtr>::const_iterator p; for(p = endpoints.begin(); p != endpoints.end(); ++p) { diff --git a/cpp/src/Ice/ObjectAdapterI.cpp b/cpp/src/Ice/ObjectAdapterI.cpp index 954e3976ad5..774bb1a45cc 100644 --- a/cpp/src/Ice/ObjectAdapterI.cpp +++ b/cpp/src/Ice/ObjectAdapterI.cpp @@ -766,8 +766,7 @@ Ice::ObjectAdapterI::ObjectAdapterI(const InstancePtr& instance, const Communica // Add the router's server proxy endpoints to this object // adapter. // - ObjectPrx proxy = _routerInfo->getServerProxy(); - vector<EndpointIPtr> endpoints = proxy->__reference()->getEndpoints(); + vector<EndpointIPtr> endpoints = _routerInfo->getServerEndpoints(); copy(endpoints.begin(), endpoints.end(), back_inserter(_routerEndpoints)); sort(_routerEndpoints.begin(), _routerEndpoints.end()); // Must be sorted. _routerEndpoints.erase(unique(_routerEndpoints.begin(), _routerEndpoints.end()), diff --git a/cpp/src/Ice/PropertyNames.cpp b/cpp/src/Ice/PropertyNames.cpp index 37e79d028e0..58ad2855937 100644 --- a/cpp/src/Ice/PropertyNames.cpp +++ b/cpp/src/Ice/PropertyNames.cpp @@ -7,7 +7,7 @@ // // ********************************************************************** -// Generated by makeprops.py from file `../config/PropertyNames.def', Fri Dec 22 00:37:02 2006 +// Generated by makeprops.py from file `../config/PropertyNames.def', Wed Jan 3 13:36:27 2007 // IMPORTANT: Do not edit this file -- any edits made here will be lost! @@ -362,6 +362,7 @@ const char* IceInternal::PropertyNames::Glacier2Props[] = "Glacier2.PermissionsVerifier.Locator", "Glacier2.PermissionsVerifier.Router", "Glacier2.PermissionsVerifier.CollocationOptimization", + "Glacier2.ReturnClientProxy", "Glacier2.SSLPermissionsVerifier", "Glacier2.SSLPermissionsVerifier.EndpointSelection", "Glacier2.SSLPermissionsVerifier.ConnectionCached", diff --git a/cpp/src/Ice/PropertyNames.h b/cpp/src/Ice/PropertyNames.h index 6ec5187aba3..0b666cdbe0b 100644 --- a/cpp/src/Ice/PropertyNames.h +++ b/cpp/src/Ice/PropertyNames.h @@ -7,7 +7,7 @@ // // ********************************************************************** -// Generated by makeprops.py from file `../config/PropertyNames.def', Fri Dec 22 00:37:02 2006 +// Generated by makeprops.py from file `../config/PropertyNames.def', Wed Jan 3 13:36:27 2007 // IMPORTANT: Do not edit this file -- any edits made here will be lost! diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp index 53307f531b8..61e0c1d44e2 100644 --- a/cpp/src/Ice/Reference.cpp +++ b/cpp/src/Ice/Reference.cpp @@ -735,8 +735,7 @@ IceInternal::RoutableReference::getRoutedEndpoints() const // If we route, we send everything to the router's client // proxy endpoints. // - ObjectPrx clientProxy = _routerInfo->getClientProxy(); - return clientProxy->__reference()->getEndpoints(); + return _routerInfo->getClientEndpoints(); } return vector<EndpointIPtr>(); } diff --git a/cpp/src/Ice/RouterInfo.cpp b/cpp/src/Ice/RouterInfo.cpp index 9347ff82c09..33e59a2f218 100644 --- a/cpp/src/Ice/RouterInfo.cpp +++ b/cpp/src/Ice/RouterInfo.cpp @@ -12,6 +12,7 @@ #include <Ice/LocalException.h> #include <Ice/Connection.h> // For ice_connection()->timeout(). #include <Ice/Functional.h> +#include <Ice/Reference.h> using namespace std; using namespace Ice; @@ -120,8 +121,8 @@ IceInternal::RouterInfo::destroy() { IceUtil::Mutex::Lock sync(*this); - _clientProxy = 0; - _serverProxy = 0; + _clientEndpoints.clear(); + _serverEndpoints.clear(); _adapter = 0; _identities.clear(); } @@ -153,85 +154,65 @@ IceInternal::RouterInfo::getRouter() const return _router; } -ObjectPrx -IceInternal::RouterInfo::getClientProxy() +vector<EndpointIPtr> +IceInternal::RouterInfo::getClientEndpoints() { IceUtil::Mutex::Lock sync(*this); - if(!_clientProxy) // Lazy initialization. + if(_clientEndpoints.size() == 0) // Lazy initialization. { - _clientProxy = _router->getClientProxy(); - if(!_clientProxy) + ObjectPrx clientProxy = _router->getClientProxy(); + if(!clientProxy) { - 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. - // - try - { - _clientProxy = _clientProxy->ice_timeout(_router->ice_getConnection()->timeout()); + // + // If getClientProxy() return nil, use router endpoints. + // + _clientEndpoints = _router->__reference()->getEndpoints(); } - catch(const Ice::CollocationOptimizationException&) + else { - // Ignore - collocated router + 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. + // + try + { + clientProxy = clientProxy->ice_timeout(_router->ice_getConnection()->timeout()); + } + catch(const Ice::CollocationOptimizationException&) + { + // Ignore - collocated router + } + + _clientEndpoints = clientProxy->__reference()->getEndpoints(); } } - return _clientProxy; + return _clientEndpoints; } -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. - // - try - { - _clientProxy = _clientProxy->ice_timeout(_router->ice_getConnection()->timeout()); - } - catch(const Ice::CollocationOptimizationException&) - { - // Ignore - collocated router - } -} - -ObjectPrx -IceInternal::RouterInfo::getServerProxy() +vector<EndpointIPtr> +IceInternal::RouterInfo::getServerEndpoints() { IceUtil::Mutex::Lock sync(*this); - if(!_serverProxy) // Lazy initialization. + if(_serverEndpoints.size() == 0) // Lazy initialization. { - _serverProxy = _router->getServerProxy(); - if(!_serverProxy) + ObjectPrx serverProxy = _router->getServerProxy(); + if(!serverProxy) { throw NoEndpointException(__FILE__, __LINE__); } - _serverProxy = _serverProxy->ice_router(0); // The server proxy cannot be routed. + serverProxy = serverProxy->ice_router(0); // The server proxy cannot be routed. + + _serverEndpoints = serverProxy->__reference()->getEndpoints(); } - return _serverProxy; -} - -void -IceInternal::RouterInfo::setServerProxy(const ObjectPrx& serverProxy) -{ - IceUtil::Mutex::Lock sync(*this); - - _serverProxy = serverProxy->ice_router(0); // The server proxy cannot be routed. + return _serverEndpoints; } void diff --git a/cpp/src/Ice/RouterInfo.h b/cpp/src/Ice/RouterInfo.h index 71d885cb394..32dacb0750a 100644 --- a/cpp/src/Ice/RouterInfo.h +++ b/cpp/src/Ice/RouterInfo.h @@ -15,6 +15,7 @@ #include <Ice/RouterInfoF.h> #include <Ice/RouterF.h> #include <Ice/ProxyF.h> +#include <Ice/EndpointIF.h> #include <set> @@ -55,10 +56,8 @@ public: bool operator<(const RouterInfo&) const; Ice::RouterPrx getRouter() const; - Ice::ObjectPrx getClientProxy(); - void setClientProxy(const Ice::ObjectPrx&); - Ice::ObjectPrx getServerProxy(); - void setServerProxy(const Ice::ObjectPrx&); + std::vector<IceInternal::EndpointIPtr> getClientEndpoints(); + std::vector<IceInternal::EndpointIPtr> getServerEndpoints(); void addProxy(const Ice::ObjectPrx&); void setAdapter(const Ice::ObjectAdapterPtr&); Ice::ObjectAdapterPtr getAdapter() const; @@ -66,8 +65,8 @@ public: private: const Ice::RouterPrx _router; - Ice::ObjectPrx _clientProxy; - Ice::ObjectPrx _serverProxy; + std::vector<IceInternal::EndpointIPtr> _clientEndpoints; + std::vector<IceInternal::EndpointIPtr> _serverEndpoints; Ice::ObjectAdapterPtr _adapter; std::set<Ice::Identity> _identities; }; |