diff options
author | Marc Laukien <marc@zeroc.com> | 2001-08-25 01:37:09 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2001-08-25 01:37:09 +0000 |
commit | a60f5311d60553dea75bffa5d3b38ec6b6eeee35 (patch) | |
tree | a4bbaa39b50f85a15b59b1a802a21a2c08a3d487 /cpp/src | |
parent | ThreadPool fixes; Win fixes (diff) | |
download | ice-a60f5311d60553dea75bffa5d3b38ec6b6eeee35.tar.bz2 ice-a60f5311d60553dea75bffa5d3b38ec6b6eeee35.tar.xz ice-a60f5311d60553dea75bffa5d3b38ec6b6eeee35.zip |
fixes
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Ice/Proxy.cpp | 21 | ||||
-rw-r--r-- | cpp/src/Ice/Reference.cpp | 13 | ||||
-rw-r--r-- | cpp/src/Ice/Reference.h | 1 | ||||
-rw-r--r-- | cpp/src/IcePack/AdminI.cpp | 27 | ||||
-rw-r--r-- | cpp/src/IcePack/AdminI.h | 6 | ||||
-rw-r--r-- | cpp/src/IcePack/Forward.cpp | 9 | ||||
-rw-r--r-- | cpp/src/IcePack/Parser.cpp | 2 |
7 files changed, 52 insertions, 27 deletions
diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp index e818d04df6a..3b3ae6acaa5 100644 --- a/cpp/src/Ice/Proxy.cpp +++ b/cpp/src/Ice/Proxy.cpp @@ -151,6 +151,27 @@ IceProxy::Ice::Object::operator<(const Object& r) const return _reference->identity < r._reference->identity; } +std::string +IceProxy::Ice::Object::_getIdentity() const +{ + return _reference->identity; +} + +::Ice::ObjectPrx +IceProxy::Ice::Object::_newIdentity(const std::string& newIdentity) const +{ + if (newIdentity == _reference->identity) + { + return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this)); + } + else + { + ObjectPrx proxy(new ::IceProxy::Ice::Object()); + proxy->setup(_reference->changeIdentity(newIdentity)); + return proxy; + } +} + ObjectPrx IceProxy::Ice::Object::_twoway() const { diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp index cf6bc223790..eee6feee1ee 100644 --- a/cpp/src/Ice/Reference.cpp +++ b/cpp/src/Ice/Reference.cpp @@ -203,6 +203,19 @@ IceInternal::Reference::streamWrite(Stream* s) const } ReferencePtr +IceInternal::Reference::changeIdentity(const string& newIdentity) const +{ + if (newIdentity == identity) + { + return ReferencePtr(const_cast<Reference*>(this)); + } + else + { + return new Reference(instance, newIdentity, origEndpoints, endpoints); + } +} + +ReferencePtr IceInternal::Reference::changeTimeout(int timeout) const { vector<EndpointPtr>::const_iterator p; diff --git a/cpp/src/Ice/Reference.h b/cpp/src/Ice/Reference.h index 0453b71e07d..bac2d947c17 100644 --- a/cpp/src/Ice/Reference.h +++ b/cpp/src/Ice/Reference.h @@ -54,6 +54,7 @@ public: // Get a new reference, based on the existing one, overwriting // certain values. // + ReferencePtr changeIdentity(const std::string&) const; ReferencePtr changeTimeout(int) const; ReferencePtr changeMode(Mode) const; ReferencePtr changeEndpoints(const std::vector<EndpointPtr>&) const; diff --git a/cpp/src/IcePack/AdminI.cpp b/cpp/src/IcePack/AdminI.cpp index b2c56c11bce..4a09e24b281 100644 --- a/cpp/src/IcePack/AdminI.cpp +++ b/cpp/src/IcePack/AdminI.cpp @@ -27,37 +27,26 @@ IcePack::AdminI::add(const ServerDescriptionPtr& p) if (p && p->object) { - _map[p->object] = p; + _map[p->object->_getIdentity()] = p; } } void -IcePack::AdminI::remove(const ObjectPrx& p) +IcePack::AdminI::remove(const string& identity) { JTCSyncT<JTCMutex> sync(*this); - - if (p) - { - _map.erase(p); - } + _map.erase(identity); } ServerDescriptionPtr -IcePack::AdminI::find(const ObjectPrx& p) +IcePack::AdminI::find(const string& identity) { JTCSyncT<JTCMutex> sync(*this); - if (p) + map<string, ServerDescriptionPtr>::iterator p = _map.find(identity); + if (p != _map.end()) { - map<ObjectPrx, ServerDescriptionPtr>::iterator q = _map.find(p); - if (q != _map.end()) - { - return q->second; - } - else - { - return 0; - } + return p->second; } else { @@ -70,7 +59,7 @@ IcePack::AdminI::getAll() { ServerDescriptions result; result.reserve(_map.size()); - for (map<ObjectPrx, ServerDescriptionPtr>::iterator p = _map.begin(); p != _map.end(); ++p) + for (map<string, ServerDescriptionPtr>::iterator p = _map.begin(); p != _map.end(); ++p) { result.push_back(p->second); } diff --git a/cpp/src/IcePack/AdminI.h b/cpp/src/IcePack/AdminI.h index 828de030cd5..591c58fdf84 100644 --- a/cpp/src/IcePack/AdminI.h +++ b/cpp/src/IcePack/AdminI.h @@ -24,15 +24,15 @@ public: AdminI(const Ice::CommunicatorPtr&); virtual void add(const ServerDescriptionPtr&); - virtual void remove(const Ice::ObjectPrx&); - virtual ServerDescriptionPtr find(const Ice::ObjectPrx&); + virtual void remove(const std::string&); + virtual ServerDescriptionPtr find(const std::string&); virtual ServerDescriptions getAll(); virtual void shutdown(); private: Ice::CommunicatorPtr _communicator; - std::map<Ice::ObjectPrx, ServerDescriptionPtr> _map; + std::map<std::string, ServerDescriptionPtr> _map; }; } diff --git a/cpp/src/IcePack/Forward.cpp b/cpp/src/IcePack/Forward.cpp index 91162b5ef3a..a5bbc9197df 100644 --- a/cpp/src/IcePack/Forward.cpp +++ b/cpp/src/IcePack/Forward.cpp @@ -40,8 +40,7 @@ IcePack::Forward::locate(const ObjectAdapterPtr& adapter, const string& identity // // Look up the server description // - ObjectPrx proxy = adapter->identityToProxy(identity); - ServerDescriptionPtr desc = _admin->find(proxy); + ServerDescriptionPtr desc = _admin->find(identity); // // If we didn't find a server description, we return null, meaning @@ -52,6 +51,8 @@ IcePack::Forward::locate(const ObjectAdapterPtr& adapter, const string& identity return 0; } + ObjectPrx object = desc->object; + #ifndef WIN32 // // We only try to activate if we have a path for the server @@ -95,7 +96,7 @@ IcePack::Forward::locate(const ObjectAdapterPtr& adapter, const string& identity // server timeout, a crash, or an explicit // shutdown method. // - proxy->_ping(); + object->_ping(); // // Everything ok, the server is now up and @@ -142,7 +143,7 @@ IcePack::Forward::locate(const ObjectAdapterPtr& adapter, const string& identity } #endif - throw LocationForward(desc->object); + throw LocationForward(object); } void diff --git a/cpp/src/IcePack/Parser.cpp b/cpp/src/IcePack/Parser.cpp index 39ea972cd86..1f3febedad8 100644 --- a/cpp/src/IcePack/Parser.cpp +++ b/cpp/src/IcePack/Parser.cpp @@ -87,7 +87,7 @@ IcePack::Parser::remove(const list<string>& args) try { - _admin->remove(_communicator->stringToProxy(args.front())); + _admin->remove(args.front()); } catch(const LocalException& ex) { |