summaryrefslogtreecommitdiff
path: root/cppe/src
diff options
context:
space:
mode:
Diffstat (limited to 'cppe/src')
-rw-r--r--cppe/src/IceE/ObjectAdapter.cpp3
-rwxr-xr-xcppe/src/IceE/OutgoingConnectionFactory.cpp3
-rw-r--r--cppe/src/IceE/Reference.cpp3
-rw-r--r--cppe/src/IceE/RouterInfo.cpp78
-rw-r--r--cppe/src/IceE/RouterInfo.h11
5 files changed, 41 insertions, 57 deletions
diff --git a/cppe/src/IceE/ObjectAdapter.cpp b/cppe/src/IceE/ObjectAdapter.cpp
index f5508c1a2a1..fc3bc266a57 100644
--- a/cppe/src/IceE/ObjectAdapter.cpp
+++ b/cppe/src/IceE/ObjectAdapter.cpp
@@ -662,8 +662,7 @@ Ice::ObjectAdapter::ObjectAdapter(const InstancePtr& instance, const Communicato
// Add the router's server proxy endpoints to this object
// adapter.
//
- ObjectPrx proxy = _routerInfo->getServerProxy();
- vector<EndpointPtr> endpoints = proxy->__reference()->getEndpoints();
+ vector<EndpointPtr> 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/cppe/src/IceE/OutgoingConnectionFactory.cpp b/cppe/src/IceE/OutgoingConnectionFactory.cpp
index 3bba269e220..674fb5b3f0d 100755
--- a/cppe/src/IceE/OutgoingConnectionFactory.cpp
+++ b/cppe/src/IceE/OutgoingConnectionFactory.cpp
@@ -346,11 +346,10 @@ IceInternal::OutgoingConnectionFactory::setRouterInfo(const RouterInfoPtr& route
// connections, so that callbacks from the router can be
// received over such connections.
//
- ObjectPrx proxy = routerInfo->getClientProxy();
#ifndef ICEE_PURE_CLIENT
ObjectAdapterPtr adapter = routerInfo->getAdapter();
#endif
- vector<EndpointPtr> endpoints = proxy->__reference()->getEndpoints();
+ vector<EndpointPtr> endpoints = routerInfo->getClientEndpoints();
vector<EndpointPtr>::const_iterator p;
for(p = endpoints.begin(); p != endpoints.end(); ++p)
{
diff --git a/cppe/src/IceE/Reference.cpp b/cppe/src/IceE/Reference.cpp
index 299ff31cc00..7fc96b442e3 100644
--- a/cppe/src/IceE/Reference.cpp
+++ b/cppe/src/IceE/Reference.cpp
@@ -625,8 +625,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<EndpointPtr>();
}
diff --git a/cppe/src/IceE/RouterInfo.cpp b/cppe/src/IceE/RouterInfo.cpp
index 03ee53a0c4b..8a864dfbcad 100644
--- a/cppe/src/IceE/RouterInfo.cpp
+++ b/cppe/src/IceE/RouterInfo.cpp
@@ -13,6 +13,7 @@
#include <IceE/RouterInfo.h>
#include <IceE/Router.h>
+#include <IceE/Reference.h>
#include <IceE/LocalException.h>
#include <IceE/Connection.h> // For ice_getConnection()->timeout().
#include <IceE/Functional.h>
@@ -121,8 +122,8 @@ IceInternal::RouterInfo::destroy()
{
IceUtil::Mutex::Lock sync(*this);
- _clientProxy = 0;
- _serverProxy = 0;
+ _clientEndpoints.clear();
+ _serverEndpoints.clear();
#ifndef ICEE_PURE_CLIENT
_adapter = 0;
#endif
@@ -156,71 +157,58 @@ IceInternal::RouterInfo::getRouter() const
return _router;
}
-ObjectPrx
-IceInternal::RouterInfo::getClientProxy()
+vector<EndpointPtr>
+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__);
+ //
+ // If getClientProxy() return nil, use router endpoints.
+ //
+ _clientEndpoints = _router->__reference()->getEndpoints();
}
+ else
+ {
+ clientProxy = clientProxy->ice_router(0); // The client proxy cannot be routed.
- _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_getConnection()->timeout());
- //
- // 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_getConnection()->timeout());
+ _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.
- //
- _clientProxy = _clientProxy->ice_timeout(_router->ice_getConnection()->timeout());
-}
-
-ObjectPrx
-IceInternal::RouterInfo::getServerProxy()
+vector<EndpointPtr>
+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/cppe/src/IceE/RouterInfo.h b/cppe/src/IceE/RouterInfo.h
index 31dbba0df1a..49372c1c6d5 100644
--- a/cppe/src/IceE/RouterInfo.h
+++ b/cppe/src/IceE/RouterInfo.h
@@ -19,6 +19,7 @@
#ifndef ICEE_PURE_CLIENT
# include <IceE/ObjectAdapterF.h>
#endif
+#include <IceE/EndpointF.h>
#include <IceE/Shared.h>
#include <IceE/Mutex.h>
@@ -61,10 +62,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::EndpointPtr> getClientEndpoints();
+ std::vector<IceInternal::EndpointPtr> getServerEndpoints();
void addProxy(const Ice::ObjectPrx&);
#ifndef ICEE_PURE_CLIENT
void setAdapter(const Ice::ObjectAdapterPtr&);
@@ -74,8 +73,8 @@ public:
private:
const Ice::RouterPrx _router;
- Ice::ObjectPrx _clientProxy;
- Ice::ObjectPrx _serverProxy;
+ std::vector<IceInternal::EndpointPtr> _clientEndpoints;
+ std::vector<IceInternal::EndpointPtr> _serverEndpoints;
#ifndef ICEE_PURE_CLIENT
Ice::ObjectAdapterPtr _adapter;
#endif