diff options
author | Benoit Foucher <benoit@zeroc.com> | 2004-10-26 15:14:29 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2004-10-26 15:14:29 +0000 |
commit | 1ef750a425c2c60cd43826af1722ec60e0c65c1d (patch) | |
tree | d704314b613b6e5265d331f849a89ef5d73621ca /cpp/src/IcePack/ServerRegistryI.cpp | |
parent | install fix (diff) | |
download | ice-1ef750a425c2c60cd43826af1722ec60e0c65c1d.tar.bz2 ice-1ef750a425c2c60cd43826af1722ec60e0c65c1d.tar.xz ice-1ef750a425c2c60cd43826af1722ec60e0c65c1d.zip |
IcePack bug fixes
Diffstat (limited to 'cpp/src/IcePack/ServerRegistryI.cpp')
-rw-r--r-- | cpp/src/IcePack/ServerRegistryI.cpp | 48 |
1 files changed, 32 insertions, 16 deletions
diff --git a/cpp/src/IcePack/ServerRegistryI.cpp b/cpp/src/IcePack/ServerRegistryI.cpp index 42f637841dd..8f06a40fde9 100644 --- a/cpp/src/IcePack/ServerRegistryI.cpp +++ b/cpp/src/IcePack/ServerRegistryI.cpp @@ -34,35 +34,51 @@ void IcePack::ServerRegistryI::add(const string& name, const ServerPrx& server, const ServerDescriptorPtr& descriptor, - const Ice::Current&) + const Ice::Current& current) { - Freeze::ConnectionPtr connection = Freeze::createConnection(_communicator, _envName); - StringObjectProxyDict dict(connection, _dbName); - StringServerDescriptorDict dictDescriptor(connection, _dbDescriptorName); - - StringObjectProxyDict::iterator p = dict.find(name); - if(p != dict.end()) + while(true) { + ServerPrx oldServer; try { - p->second->ice_ping(); + oldServer = findByName(name, current); + oldServer->ice_ping(); throw ServerExistsException(); } + catch(const ServerNotExistException&) + { + } catch(const Ice::ObjectNotExistException&) { } catch(const Ice::LocalException&) { + throw ServerExistsException(); + } + + Freeze::ConnectionPtr connection = Freeze::createConnection(_communicator, _envName); + StringObjectProxyDict dict(connection, _dbName); + StringServerDescriptorDict dictDescriptor(connection, _dbDescriptorName); + + StringObjectProxyDict::iterator p = dict.find(name); + if(p != dict.end()) + { + if(oldServer && oldServer != p->second) + { + continue; + } } - } - - dict.put(pair<const string, const Ice::ObjectPrx>(name, server)); - dictDescriptor.put(pair<const string, const ServerDescriptorPtr>(name, descriptor)); - if(_traceLevels->serverRegistry > 0) - { - Ice::Trace out(_traceLevels->logger, _traceLevels->serverRegistryCat); - out << "added server `" << name << "'"; + dict.put(pair<const string, const Ice::ObjectPrx>(name, server)); + dictDescriptor.put(pair<const string, const ServerDescriptorPtr>(name, descriptor)); + + if(_traceLevels->serverRegistry > 0) + { + Ice::Trace out(_traceLevels->logger, _traceLevels->serverRegistryCat); + out << "added server `" << name << "'"; + } + + break; } } |