diff options
author | Benoit Foucher <benoit@zeroc.com> | 2014-04-15 09:41:21 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2014-04-15 09:41:21 +0200 |
commit | 54884a0b4c139118fc49498b6d6715d7d9ab718c (patch) | |
tree | 1f00091ad68543b3dc9828f27e32c0d9f7d072fe /cpp/src/IceGrid/Util.cpp | |
parent | VC11 fixes for PHP 5.5 (diff) | |
download | ice-54884a0b4c139118fc49498b6d6715d7d9ab718c.tar.bz2 ice-54884a0b4c139118fc49498b6d6715d7d9ab718c.tar.xz ice-54884a0b4c139118fc49498b6d6715d7d9ab718c.zip |
Added support for IceGrid custom load balancing
Diffstat (limited to 'cpp/src/IceGrid/Util.cpp')
-rw-r--r-- | cpp/src/IceGrid/Util.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/cpp/src/IceGrid/Util.cpp b/cpp/src/IceGrid/Util.cpp index 6ebedd4629a..5b0fc8d72fc 100644 --- a/cpp/src/IceGrid/Util.cpp +++ b/cpp/src/IceGrid/Util.cpp @@ -63,8 +63,7 @@ IceGrid::toString(const Ice::Exception& exception) string IceGrid::getProperty(const PropertyDescriptorSeq& properties, const string& name, const string& def) { - string result = def; - + string result; for(PropertyDescriptorSeq::const_iterator q = properties.begin(); q != properties.end(); ++q) { if(q->name == name) @@ -72,6 +71,10 @@ IceGrid::getProperty(const PropertyDescriptorSeq& properties, const string& name result = q->value; } } + if(result.empty()) + { + return def; + } return result; } @@ -175,15 +178,15 @@ IceGrid::escapeProperty(const string& s, bool escapeEqual) } ObjectInfo -IceGrid::toObjectInfo(const Ice::CommunicatorPtr& communicator, const ObjectDescriptor& object, const string& adapterId) +IceGrid::toObjectInfo(const Ice::CommunicatorPtr& communicator, const ObjectDescriptor& obj, const string& adapterId) { ObjectInfo info; - info.type = object.type; + info.type = obj.type; ostringstream proxyStr; - proxyStr << "\"" << communicator->identityToString(object.id) << "\""; - if(!object.proxyOptions.empty()) + proxyStr << "\"" << communicator->identityToString(obj.id) << "\""; + if(!obj.proxyOptions.empty()) { - proxyStr << ' ' << object.proxyOptions; + proxyStr << ' ' << obj.proxyOptions; } proxyStr << " @ " << adapterId; try @@ -193,7 +196,7 @@ IceGrid::toObjectInfo(const Ice::CommunicatorPtr& communicator, const ObjectDesc catch(const Ice::ProxyParseException&) { ostringstream fallbackProxyStr; - fallbackProxyStr << "\"" << communicator->identityToString(object.id) << "\"" << " @ " << adapterId; + fallbackProxyStr << "\"" << communicator->identityToString(obj.id) << "\"" << " @ " << adapterId; info.proxy = communicator->stringToProxy(fallbackProxyStr.str()); } return info; |