summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/LocatorInfo.cpp43
-rw-r--r--cpp/src/Ice/Reference.cpp6
-rw-r--r--cpp/src/Ice/RouterInfo.cpp33
-rw-r--r--cpp/src/Ice/Service.cpp12
4 files changed, 83 insertions, 11 deletions
diff --git a/cpp/src/Ice/LocatorInfo.cpp b/cpp/src/Ice/LocatorInfo.cpp
index e0251dd7fce..3e8b70df196 100644
--- a/cpp/src/Ice/LocatorInfo.cpp
+++ b/cpp/src/Ice/LocatorInfo.cpp
@@ -431,12 +431,28 @@ IceInternal::LocatorInfo::getEndpoints(const ReferencePtr& ref, int ttl, const G
virtual void
ice_exception(const Ice::Exception& ex)
{
- _locatorInfo->getEndpointsException(_reference, ex, _callback);
+ if(dynamic_cast<const Ice::CollocationOptimizationException*>(&ex))
+ {
+ try
+ {
+ bool cached;
+ vector<EndpointIPtr> endpoints = _locatorInfo->getEndpoints(_reference, _ttl, cached);
+ _callback->setEndpoints(endpoints, cached);
+ }
+ catch(const Ice::LocalException& e)
+ {
+ _callback->setException(e);
+ }
+ }
+ else
+ {
+ _locatorInfo->getEndpointsException(_reference, ex, _callback);
+ }
}
Callback(const LocatorInfoPtr& locatorInfo, const LocatorTablePtr& table,
- const ReferencePtr& reference, const GetEndpointsCallbackPtr& callback) :
- _locatorInfo(locatorInfo), _table(table), _reference(reference), _callback(callback)
+ const ReferencePtr& reference, int ttl, const GetEndpointsCallbackPtr& callback) :
+ _locatorInfo(locatorInfo), _table(table), _reference(reference), _ttl(ttl), _callback(callback)
{
}
@@ -445,6 +461,7 @@ IceInternal::LocatorInfo::getEndpoints(const ReferencePtr& ref, int ttl, const G
const LocatorInfoPtr _locatorInfo;
const LocatorTablePtr _table;
const ReferencePtr _reference;
+ const int _ttl;
const GetEndpointsCallbackPtr _callback;
};
@@ -452,7 +469,7 @@ IceInternal::LocatorInfo::getEndpoints(const ReferencePtr& ref, int ttl, const G
// Search the adapter in the location service if we didn't
// find it in the cache.
//
- _locator->findAdapterById_async(new Callback(this, _table, ref, callback), adapterId);
+ _locator->findAdapterById_async(new Callback(this, _table, ref, ttl, callback), adapterId);
return;
}
else
@@ -489,7 +506,23 @@ IceInternal::LocatorInfo::getEndpoints(const ReferencePtr& ref, int ttl, const G
virtual void
ice_exception(const Ice::Exception& ex)
{
- _locatorInfo->getEndpointsException(_reference, ex, _callback);
+ if(dynamic_cast<const Ice::CollocationOptimizationException*>(&ex))
+ {
+ try
+ {
+ bool cached;
+ vector<EndpointIPtr> endpoints = _locatorInfo->getEndpoints(_reference, _ttl, cached);
+ _callback->setEndpoints(endpoints, cached);
+ }
+ catch(const Ice::LocalException& e)
+ {
+ _callback->setException(e);
+ }
+ }
+ else
+ {
+ _locatorInfo->getEndpointsException(_reference, ex, _callback);
+ }
}
Callback(const LocatorInfoPtr& locatorInfo, const ReferencePtr& reference, int ttl,
diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp
index 4491a5bd0d1..464820b4ed1 100644
--- a/cpp/src/Ice/Reference.cpp
+++ b/cpp/src/Ice/Reference.cpp
@@ -1647,7 +1647,7 @@ IceInternal::RoutableReference::createConnection(const vector<EndpointIPtr>& all
// (if any) to the new connection, so that callbacks from the
// router can be received over this new connection.
//
- if(_routerInfo)
+ if(_routerInfo && _routerInfo->getAdapter())
{
connection->setAdapter(_routerInfo->getAdapter());
}
@@ -1684,7 +1684,7 @@ IceInternal::RoutableReference::createConnection(const vector<EndpointIPtr>& all
// (if any) to the new connection, so that callbacks from the
// router can be received over this new connection.
//
- if(_routerInfo)
+ if(_routerInfo && _routerInfo->getAdapter())
{
connection->setAdapter(_routerInfo->getAdapter());
}
@@ -1729,7 +1729,7 @@ IceInternal::RoutableReference::createConnection(const vector<EndpointIPtr>& all
// (if any) to the new connection, so that callbacks from the
// router can be received over this new connection.
//
- if(_reference->getRouterInfo())
+ if(_reference->getRouterInfo() && _reference->getRouterInfo()->getAdapter())
{
connection->setAdapter(_reference->getRouterInfo()->getAdapter());
}
diff --git a/cpp/src/Ice/RouterInfo.cpp b/cpp/src/Ice/RouterInfo.cpp
index cad1a60e862..5e62d7979f0 100644
--- a/cpp/src/Ice/RouterInfo.cpp
+++ b/cpp/src/Ice/RouterInfo.cpp
@@ -193,7 +193,21 @@ IceInternal::RouterInfo::getClientEndpoints(const GetClientEndpointsCallbackPtr&
virtual void
ice_exception(const Ice::Exception& ex)
{
- _callback->setException(dynamic_cast<const Ice::LocalException&>(ex));
+ if(dynamic_cast<const Ice::CollocationOptimizationException*>(&ex))
+ {
+ try
+ {
+ _callback->setEndpoints(_routerInfo->getClientEndpoints());
+ }
+ catch(const Ice::LocalException& e)
+ {
+ _callback->setException(e);
+ }
+ }
+ else
+ {
+ _callback->setException(dynamic_cast<const Ice::LocalException&>(ex));
+ }
}
Callback(const RouterInfoPtr& routerInfo, const GetClientEndpointsCallbackPtr& callback) :
@@ -274,7 +288,22 @@ IceInternal::RouterInfo::addProxy(const Ice::ObjectPrx& proxy, const AddProxyCal
virtual void
ice_exception(const Ice::Exception& ex)
{
- _callback->setException(dynamic_cast<const Ice::LocalException&>(ex));
+ if(dynamic_cast<const Ice::CollocationOptimizationException*>(&ex))
+ {
+ try
+ {
+ _routerInfo->addProxy(_proxy);
+ _callback->addedProxy();
+ }
+ catch(const Ice::LocalException& e)
+ {
+ _callback->setException(e);
+ }
+ }
+ else
+ {
+ _callback->setException(dynamic_cast<const Ice::LocalException&>(ex));
+ }
}
Callback(const RouterInfoPtr& routerInfo, const Ice::ObjectPrx& proxy, const AddProxyCallbackPtr& callback) :
diff --git a/cpp/src/Ice/Service.cpp b/cpp/src/Ice/Service.cpp
index 123083abf27..af3838b2b5c 100644
--- a/cpp/src/Ice/Service.cpp
+++ b/cpp/src/Ice/Service.cpp
@@ -389,7 +389,17 @@ Ice::Service::main(int& argc, char* argv[], const InitializationData& initializa
// Ice.EventLog.Source on Windows.
//
InitializationData initData = initializationData;
- initData.properties = createProperties(argc, argv, initData.properties, initData.stringConverter);
+ try
+ {
+ initData.properties = createProperties(argc, argv, initData.properties, initData.stringConverter);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ ostringstream ostr;
+ ostr << ex;
+ error(ostr.str());
+ return EXIT_FAILURE;
+ }
#ifdef _WIN32