summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/ConnectionFactory.cpp
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2005-09-19 05:54:42 +0000
committerMatthew Newhook <matthew@zeroc.com>2005-09-19 05:54:42 +0000
commita11ea64ba4cc566f1928b5df36d4b8114d57e8f0 (patch)
treeb33f8818a35f03fffdc46963639e4302c66b1e64 /cpp/src/Ice/ConnectionFactory.cpp
parentminor refactoring (diff)
downloadice-a11ea64ba4cc566f1928b5df36d4b8114d57e8f0.tar.bz2
ice-a11ea64ba4cc566f1928b5df36d4b8114d57e8f0.tar.xz
ice-a11ea64ba4cc566f1928b5df36d4b8114d57e8f0.zip
http://bugzilla.zeroc.com/bugzilla/show_bug.cgi?id=435. added
removeRouter().
Diffstat (limited to 'cpp/src/Ice/ConnectionFactory.cpp')
-rw-r--r--cpp/src/Ice/ConnectionFactory.cpp90
1 files changed, 44 insertions, 46 deletions
diff --git a/cpp/src/Ice/ConnectionFactory.cpp b/cpp/src/Ice/ConnectionFactory.cpp
index d6ae53d56ce..b720f2b274c 100644
--- a/cpp/src/Ice/ConnectionFactory.cpp
+++ b/cpp/src/Ice/ConnectionFactory.cpp
@@ -370,7 +370,7 @@ IceInternal::OutgoingConnectionFactory::create(const vector<EndpointIPtr>& endpt
}
void
-IceInternal::OutgoingConnectionFactory::setRouter(const RouterPrx& router)
+IceInternal::OutgoingConnectionFactory::setRouterInfo(const RouterInfoPtr& routerInfo)
{
IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
@@ -379,61 +379,59 @@ IceInternal::OutgoingConnectionFactory::setRouter(const RouterPrx& router)
throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
- RouterInfoPtr routerInfo = _instance->routerManager()->get(router);
- if(routerInfo)
+ assert(routerInfo);
+
+ //
+ // Search for connections to the router's client proxy endpoints,
+ // and update the object adapter for such connections, so that
+ // 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>::const_iterator p;
+ for(p = endpoints.begin(); p != endpoints.end(); ++p)
{
+ EndpointIPtr endpoint = *p;
+
//
- // Search for connections to the router's client proxy
- // endpoints, and update the object adapter for such
- // connections, so that callbacks from the router can be
- // received over such connections.
+ // Modify endpoints with overrides.
//
- ObjectPrx proxy = routerInfo->getClientProxy();
- ObjectAdapterPtr adapter = routerInfo->getAdapter();
- vector<EndpointIPtr> endpoints = proxy->__reference()->getEndpoints();
- vector<EndpointIPtr>::const_iterator p;
- for(p = endpoints.begin(); p != endpoints.end(); ++p)
+ if(_instance->defaultsAndOverrides()->overrideTimeout)
{
- EndpointIPtr endpoint = *p;
+ endpoint = endpoint->timeout(_instance->defaultsAndOverrides()->overrideTimeoutValue);
+ }
- //
- // Modify endpoints with overrides.
- //
- if(_instance->defaultsAndOverrides()->overrideTimeout)
- {
- endpoint = endpoint->timeout(_instance->defaultsAndOverrides()->overrideTimeoutValue);
- }
+ //
+ // The Connection object does not take the compression flag of
+ // endpoints into account, but instead gets the information
+ // about whether messages should be compressed or not from
+ // other sources. In order to allow connection sharing for
+ // endpoints that differ in the value of the compression flag
+ // only, we always set the compression flag to false here in
+ // this connection factory.
+ //
+ endpoint = endpoint->compress(false);
- //
- // The Connection object does not take the compression flag of
- // endpoints into account, but instead gets the information
- // about whether messages should be compressed or not from
- // other sources. In order to allow connection sharing for
- // endpoints that differ in the value of the compression flag
- // only, we always set the compression flag to false here in
- // this connection factory.
- //
- endpoint = endpoint->compress(false);
+ pair<multimap<EndpointIPtr, ConnectionIPtr>::iterator,
+ multimap<EndpointIPtr, ConnectionIPtr>::iterator> pr = _connections.equal_range(endpoint);
- pair<multimap<EndpointIPtr, ConnectionIPtr>::iterator,
- multimap<EndpointIPtr, ConnectionIPtr>::iterator> pr = _connections.equal_range(endpoint);
-
- while(pr.first != pr.second)
+ while(pr.first != pr.second)
+ {
+ try
{
- try
- {
- pr.first->second->setAdapter(adapter);
- }
- catch(const Ice::LocalException&)
- {
- //
- // Ignore, the connection is being closed or closed.
- //
- }
- ++pr.first;
+ pr.first->second->setAdapter(adapter);
+ }
+ catch(const Ice::LocalException&)
+ {
+ //
+ // Ignore, the connection is being closed or closed.
+ //
}
+ ++pr.first;
}
- }
+ }
}
void