diff options
author | Marc Laukien <marc@zeroc.com> | 2006-03-18 01:21:07 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2006-03-18 01:21:07 +0000 |
commit | b222eb122a4ac5620a7f97c6a0b3e52c89854793 (patch) | |
tree | 9d5e02ea1b0f571cef10f035649d3885227e0ce3 /cpp/src/Ice/RouterInfo.cpp | |
parent | fix for destroySession (diff) | |
download | ice-b222eb122a4ac5620a7f97c6a0b3e52c89854793.tar.bz2 ice-b222eb122a4ac5620a7f97c6a0b3e52c89854793.tar.xz ice-b222eb122a4ac5620a7f97c6a0b3e52c89854793.zip |
more router stuff
Diffstat (limited to 'cpp/src/Ice/RouterInfo.cpp')
-rw-r--r-- | cpp/src/Ice/RouterInfo.cpp | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/cpp/src/Ice/RouterInfo.cpp b/cpp/src/Ice/RouterInfo.cpp index a76825cc2eb..17e688cdcd4 100644 --- a/cpp/src/Ice/RouterInfo.cpp +++ b/cpp/src/Ice/RouterInfo.cpp @@ -9,7 +9,6 @@ #include <Ice/RouterInfo.h> #include <Ice/Router.h> -#include <Ice/RoutingTable.h> #include <Ice/LocalException.h> #include <Ice/Connection.h> // For ice_connection()->timeout(). #include <Ice/Functional.h> @@ -101,7 +100,7 @@ IceInternal::RouterManager::erase(const RouterPrx& rtr) } if(p != _table.end()) - {
+ { info = p->second; _table.erase(p); } @@ -111,8 +110,7 @@ IceInternal::RouterManager::erase(const RouterPrx& rtr) } IceInternal::RouterInfo::RouterInfo(const RouterPrx& router) : - _router(router), - _routingTable(new RoutingTable) + _router(router) { assert(_router); } @@ -125,7 +123,7 @@ IceInternal::RouterInfo::destroy() _clientProxy = 0; _serverProxy = 0; _adapter = 0; - _routingTable->clear(); + _map.clear(); } bool @@ -225,13 +223,25 @@ IceInternal::RouterInfo::setServerProxy(const ObjectPrx& serverProxy) void IceInternal::RouterInfo::addProxy(const ObjectPrx& proxy) { - // - // No mutex lock necessary, _routingTable is immutable, and - // RoutingTable is mutex protected. - // - if(_routingTable->add(proxy)) // Only add the proxy to the router if it's not already in the routing table. + assert(proxy); // Must not be called for null proxies. + + IceUtil::Mutex::Lock sync(*this); + + map<Identity, int>::iterator p = _map.find(proxy->ice_getIdentity()); + + if(p == _map.end()) { - _router->addProxy(proxy); + // + // 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. + // + _map.insert(_map.begin(), pair<const Identity, int>(proxy->ice_getIdentity(), 0)); } } |