diff options
Diffstat (limited to 'cpp/src/Glacier2/RoutingTable.cpp')
-rw-r--r-- | cpp/src/Glacier2/RoutingTable.cpp | 126 |
1 files changed, 63 insertions, 63 deletions
diff --git a/cpp/src/Glacier2/RoutingTable.cpp b/cpp/src/Glacier2/RoutingTable.cpp index 6a366130837..b5f73e7ed10 100644 --- a/cpp/src/Glacier2/RoutingTable.cpp +++ b/cpp/src/Glacier2/RoutingTable.cpp @@ -35,69 +35,69 @@ Glacier2::RoutingTable::add(const ObjectProxySeq& unfiltered, const Ice::Current ObjectProxySeq::const_iterator prx; for(prx = unfiltered.begin(); prx != unfiltered.end(); ++prx) { - if(!*prx) // We ignore null proxies. - { - continue; - } + if(!*prx) // We ignore null proxies. + { + continue; + } - if(!_verifier.verify(*prx)) - { - current.con->close(true); - throw ObjectNotExistException(__FILE__, __LINE__); - } - ObjectPrx proxy = (*prx)->ice_twoway()->ice_secure(false)->ice_facet(""); // We add proxies in default form. - proxies.push_back(proxy); + if(!_verifier.verify(*prx)) + { + current.con->close(true); + throw ObjectNotExistException(__FILE__, __LINE__); + } + ObjectPrx proxy = (*prx)->ice_twoway()->ice_secure(false)->ice_facet(""); // We add proxies in default form. + proxies.push_back(proxy); } ObjectProxySeq evictedProxies; for(prx = proxies.begin(); prx != proxies.end(); ++prx) { - ObjectPrx proxy = *prx; - EvictorMap::iterator p = _map.find(proxy->ice_getIdentity()); - - if(p == _map.end()) - { - if(_traceLevel == 1 || _traceLevel >= 3) - { - Trace out(_communicator->getLogger(), "Glacier2"); - out << "adding proxy to routing table:\n" << _communicator->proxyToString(proxy); - } - - EvictorEntryPtr entry = new EvictorEntry; - p = _map.insert(_map.begin(), pair<const Identity, EvictorEntryPtr>(proxy->ice_getIdentity(), entry)); - EvictorQueue::iterator q = _queue.insert(_queue.end(), p); - entry->proxy = proxy; - entry->pos = q; - } - else - { - if(_traceLevel == 1 || _traceLevel >= 3) - { - Trace out(_communicator->getLogger(), "Glacier2"); - out << "proxy already in routing table:\n" << _communicator->proxyToString(proxy); - } - - EvictorEntryPtr entry = p->second; - _queue.erase(entry->pos); - EvictorQueue::iterator q = _queue.insert(_queue.end(), p); - entry->pos = q; - } - - while(static_cast<int>(_map.size()) > _maxSize) - { - p = _queue.front(); - - if(_traceLevel >= 2) - { - Trace out(_communicator->getLogger(), "Glacier2"); - out << "evicting proxy from routing table:\n" << _communicator->proxyToString(p->second->proxy); - } - - evictedProxies.push_back(p->second->proxy); + ObjectPrx proxy = *prx; + EvictorMap::iterator p = _map.find(proxy->ice_getIdentity()); + + if(p == _map.end()) + { + if(_traceLevel == 1 || _traceLevel >= 3) + { + Trace out(_communicator->getLogger(), "Glacier2"); + out << "adding proxy to routing table:\n" << _communicator->proxyToString(proxy); + } + + EvictorEntryPtr entry = new EvictorEntry; + p = _map.insert(_map.begin(), pair<const Identity, EvictorEntryPtr>(proxy->ice_getIdentity(), entry)); + EvictorQueue::iterator q = _queue.insert(_queue.end(), p); + entry->proxy = proxy; + entry->pos = q; + } + else + { + if(_traceLevel == 1 || _traceLevel >= 3) + { + Trace out(_communicator->getLogger(), "Glacier2"); + out << "proxy already in routing table:\n" << _communicator->proxyToString(proxy); + } + + EvictorEntryPtr entry = p->second; + _queue.erase(entry->pos); + EvictorQueue::iterator q = _queue.insert(_queue.end(), p); + entry->pos = q; + } + + while(static_cast<int>(_map.size()) > _maxSize) + { + p = _queue.front(); + + if(_traceLevel >= 2) + { + Trace out(_communicator->getLogger(), "Glacier2"); + out << "evicting proxy from routing table:\n" << _communicator->proxyToString(p->second->proxy); + } + + evictedProxies.push_back(p->second->proxy); - _map.erase(p); - _queue.pop_front(); - } + _map.erase(p); + _queue.pop_front(); + } } return evictedProxies; @@ -108,7 +108,7 @@ Glacier2::RoutingTable::get(const Identity& ident) { if(ident.name.empty()) { - return 0; + return 0; } IceUtil::Mutex::Lock sync(*this); @@ -117,15 +117,15 @@ Glacier2::RoutingTable::get(const Identity& ident) if(p == _map.end()) { - return 0; + return 0; } else { - EvictorEntryPtr entry = p->second; - _queue.erase(entry->pos); - EvictorQueue::iterator q = _queue.insert(_queue.end(), p); - entry->pos = q; + EvictorEntryPtr entry = p->second; + _queue.erase(entry->pos); + EvictorQueue::iterator q = _queue.insert(_queue.end(), p); + entry->pos = q; - return entry->proxy; + return entry->proxy; } } |