diff options
author | Bernard Normier <bernard@zeroc.com> | 2007-02-01 17:09:49 +0000 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2007-02-01 17:09:49 +0000 |
commit | abada90e3f84dc703b8ddc9efcbed8a946fadead (patch) | |
tree | 2c6f9dccd510ea97cb927a7bd635422efaae547a /cpp/src/Ice/RouterInfo.cpp | |
parent | removing trace message (diff) | |
download | ice-abada90e3f84dc703b8ddc9efcbed8a946fadead.tar.bz2 ice-abada90e3f84dc703b8ddc9efcbed8a946fadead.tar.xz ice-abada90e3f84dc703b8ddc9efcbed8a946fadead.zip |
Expanded tabs into spaces
Diffstat (limited to 'cpp/src/Ice/RouterInfo.cpp')
-rw-r--r-- | cpp/src/Ice/RouterInfo.cpp | 164 |
1 files changed, 82 insertions, 82 deletions
diff --git a/cpp/src/Ice/RouterInfo.cpp b/cpp/src/Ice/RouterInfo.cpp index d5294304d2c..8eb60be1bdd 100644 --- a/cpp/src/Ice/RouterInfo.cpp +++ b/cpp/src/Ice/RouterInfo.cpp @@ -45,7 +45,7 @@ IceInternal::RouterManager::get(const RouterPrx& rtr) { if(!rtr) { - return 0; + return 0; } RouterPrx router = RouterPrx::uncheckedCast(rtr->ice_router(0)); // The router cannot be routed. @@ -56,24 +56,24 @@ IceInternal::RouterManager::get(const RouterPrx& rtr) if(_tableHint != _table.end()) { - if(_tableHint->first == router) - { - p = _tableHint; - } + if(_tableHint->first == router) + { + p = _tableHint; + } } if(p == _table.end()) { - p = _table.find(router); + p = _table.find(router); } if(p == _table.end()) { - _tableHint = _table.insert(_tableHint, pair<const RouterPrx, RouterInfoPtr>(router, new RouterInfo(router))); + _tableHint = _table.insert(_tableHint, pair<const RouterPrx, RouterInfoPtr>(router, new RouterInfo(router))); } else { - _tableHint = p; + _tableHint = p; } return _tableHint->second; @@ -85,26 +85,26 @@ IceInternal::RouterManager::erase(const RouterPrx& rtr) RouterInfoPtr info; if(rtr) { - RouterPrx router = RouterPrx::uncheckedCast(rtr->ice_router(0)); // The router cannot be routed. - IceUtil::Mutex::Lock sync(*this); - - map<RouterPrx, RouterInfoPtr>::iterator p = _table.end(); - if(_tableHint != _table.end() && _tableHint->first == router) - { - p = _tableHint; - _tableHint = _table.end(); - } - - if(p == _table.end()) - { - p = _table.find(router); - } - - if(p != _table.end()) - { - info = p->second; - _table.erase(p); - } + RouterPrx router = RouterPrx::uncheckedCast(rtr->ice_router(0)); // The router cannot be routed. + IceUtil::Mutex::Lock sync(*this); + + map<RouterPrx, RouterInfoPtr>::iterator p = _table.end(); + if(_tableHint != _table.end() && _tableHint->first == router) + { + p = _tableHint; + _tableHint = _table.end(); + } + + if(p == _table.end()) + { + p = _table.find(router); + } + + if(p != _table.end()) + { + info = p->second; + _table.erase(p); + } } return info; @@ -161,34 +161,34 @@ IceInternal::RouterInfo::getClientEndpoints() if(_clientEndpoints.size() == 0) // Lazy initialization. { - ObjectPrx clientProxy = _router->getClientProxy(); - if(!clientProxy) - { - // - // If getClientProxy() return nil, use router endpoints. - // - _clientEndpoints = _router->__reference()->getEndpoints(); - } - else - { - 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(); - } + ObjectPrx clientProxy = _router->getClientProxy(); + if(!clientProxy) + { + // + // If getClientProxy() return nil, use router endpoints. + // + _clientEndpoints = _router->__reference()->getEndpoints(); + } + else + { + 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 _clientEndpoints; @@ -201,15 +201,15 @@ IceInternal::RouterInfo::getServerEndpoints() if(_serverEndpoints.size() == 0) // Lazy initialization. { - ObjectPrx serverProxy = _router->getServerProxy(); - if(!serverProxy) - { - throw NoEndpointException(__FILE__, __LINE__); - } + 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(); + _serverEndpoints = serverProxy->__reference()->getEndpoints(); } return _serverEndpoints; @@ -226,25 +226,25 @@ IceInternal::RouterInfo::addProxy(const ObjectPrx& proxy) if(p == _identities.end()) { - // - // Only add the proxy to the router if it's not already in our local map. - // - ObjectProxySeq proxies; - proxies.push_back(proxy); - ObjectProxySeq evictedProxies = _router->addProxies(proxies); - - // - // If we successfully added the proxy to the router, we add it to our local map. - // - _identities.insert(_identities.begin(), proxy->ice_getIdentity()); - - // - // We also must remove whatever proxies the router evicted. - // - for(ObjectProxySeq::iterator q = evictedProxies.begin(); q != evictedProxies.end(); ++q) - { - _identities.erase((*q)->ice_getIdentity()); - } + // + // Only add the proxy to the router if it's not already in our local map. + // + ObjectProxySeq proxies; + proxies.push_back(proxy); + ObjectProxySeq evictedProxies = _router->addProxies(proxies); + + // + // If we successfully added the proxy to the router, we add it to our local map. + // + _identities.insert(_identities.begin(), proxy->ice_getIdentity()); + + // + // We also must remove whatever proxies the router evicted. + // + for(ObjectProxySeq::iterator q = evictedProxies.begin(); q != evictedProxies.end(); ++q) + { + _identities.erase((*q)->ice_getIdentity()); + } } } |