diff options
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/Ice/OutgoingAsync.cpp | 66 | ||||
-rw-r--r-- | cpp/test/Ice/faultTolerance/AllTests.cpp | 2 |
2 files changed, 57 insertions, 11 deletions
diff --git a/cpp/src/Ice/OutgoingAsync.cpp b/cpp/src/Ice/OutgoingAsync.cpp index 58b31d02626..b1ba114f417 100644 --- a/cpp/src/Ice/OutgoingAsync.cpp +++ b/cpp/src/Ice/OutgoingAsync.cpp @@ -155,24 +155,61 @@ IceInternal::OutgoingAsync::__finished(BasicStream& is) void IceInternal::OutgoingAsync::__finished(const LocalException& exc) { - try + bool retry = false; + + if(_reference->locatorInfo) { - ice_exception(exc); + _reference->locatorInfo->clearObjectCache(_reference); } - catch(const Exception& ex) + + if(dynamic_cast<const CloseConnectionException*>(&exc)) { - warning(ex); + try + { + ProxyFactoryPtr proxyFactory = _reference->instance->proxyFactory(); + if(proxyFactory) + { + proxyFactory->checkRetryAfterException(exc, _cnt); + } + else + { + exc.ice_throw(); // The communicator is already destroyed, so we cannot retry. + } + + retry = true; + } + catch(const LocalException&) + { + } } - catch(const std::exception& ex) + + if(retry) { - warning(ex); + _connection->decProxyCount(); + _connection = 0; + __send(); } - catch(...) + else { - warning(); + try + { + ice_exception(exc); + } + catch(const Exception& ex) + { + warning(ex); + } + catch(const std::exception& ex) + { + warning(ex); + } + catch(...) + { + warning(); + } + + cleanup(); } - - cleanup(); } bool @@ -235,6 +272,12 @@ IceInternal::OutgoingAsync::__send() { while(true) { + if(!_connection) + { + _connection = _reference->getConnection(); + _connection->incProxyCount(); + } + try { _connection->sendAsyncRequest(__os, this); @@ -257,6 +300,9 @@ IceInternal::OutgoingAsync::__send() ex.ice_throw(); // The communicator is already destroyed, so we cannot retry. } } + + _connection->decProxyCount(); + _connection = 0; } } catch(const LocalException& ex) diff --git a/cpp/test/Ice/faultTolerance/AllTests.cpp b/cpp/test/Ice/faultTolerance/AllTests.cpp index cdf1e1d3915..6180aac677a 100644 --- a/cpp/test/Ice/faultTolerance/AllTests.cpp +++ b/cpp/test/Ice/faultTolerance/AllTests.cpp @@ -186,7 +186,7 @@ allTests(const Ice::CommunicatorPtr& communicator, const vector<int>& ports) bool ami = false; for(unsigned int i = 1, j = 0; i <= ports.size(); ++i, ++j) { - if(j >= 3) + if(j > 3) { j = 0; ami = !ami; |