diff options
author | Benoit Foucher <benoit@zeroc.com> | 2020-02-20 19:22:03 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2020-02-20 19:22:03 +0100 |
commit | 7e164511561d3c4fa0de8b1dcb24fc4a25b858a4 (patch) | |
tree | fb60bbddb1138113b611648939a730a7871c19e3 /cpp | |
parent | Removed unused SSLEngine.decodeASN1Length method, fixes #686 (diff) | |
download | ice-7e164511561d3c4fa0de8b1dcb24fc4a25b858a4.tar.bz2 ice-7e164511561d3c4fa0de8b1dcb24fc4a25b858a4.tar.xz ice-7e164511561d3c4fa0de8b1dcb24fc4a25b858a4.zip |
Don't retry invocations on fixed proxies, fixes #671
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/Ice/ProxyFactory.cpp | 9 | ||||
-rw-r--r-- | cpp/test/Ice/retry/AllTests.cpp | 21 |
2 files changed, 30 insertions, 0 deletions
diff --git a/cpp/src/Ice/ProxyFactory.cpp b/cpp/src/Ice/ProxyFactory.cpp index db3ad7a5e63..7389f258b86 100644 --- a/cpp/src/Ice/ProxyFactory.cpp +++ b/cpp/src/Ice/ProxyFactory.cpp @@ -110,6 +110,15 @@ IceInternal::ProxyFactory::checkRetryAfterException(const LocalException& ex, co ex.ice_throw(); } + // + // If it's a fixed proxy, retrying isn't useful as the proxy is tied to + // the connection and the request will fail with the exception. + // + if(dynamic_cast<const FixedReference*>(ref.get())) + { + ex.ice_throw(); + } + const ObjectNotExistException* one = dynamic_cast<const ObjectNotExistException*>(&ex); if(one) { diff --git a/cpp/test/Ice/retry/AllTests.cpp b/cpp/test/Ice/retry/AllTests.cpp index 87306b5b970..b8d3d471822 100644 --- a/cpp/test/Ice/retry/AllTests.cpp +++ b/cpp/test/Ice/retry/AllTests.cpp @@ -240,6 +240,27 @@ allTests(const Ice::CommunicatorPtr& communicator, const Ice::CommunicatorPtr& c testRetryCount(4); cout << "ok" << endl; + if(retry1->ice_getCachedConnection()) + { + cout << "testing non-idempotent operation with bi-dir proxy... " << flush; + try + { + retry1->ice_fixed(retry1->ice_getCachedConnection())->opIdempotent(4); + } + catch(const Ice::Exception& ex) + { + } + testInvocationCount(1); + testFailureCount(1); + testRetryCount(0); + test(retry1->opIdempotent(4) == 4); + testInvocationCount(1); + testFailureCount(0); + // It suceeded after 3 retry because of the failed opIdempotent on the fixed proxy above + testRetryCount(3); + cout << "ok" << endl; + } + cout << "testing non-idempotent operation... " << flush; try { |