diff options
author | Benoit Foucher <benoit@zeroc.com> | 2017-06-01 11:37:10 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2017-06-01 11:37:10 +0200 |
commit | 63a9b33d2a7cfa02c51d3fd26feb59d8a939cb91 (patch) | |
tree | 09a189184be508992fb7a5bd9802b24dd36f1609 /cpp/test | |
parent | Simplify handling of single linux arch in Make.rules.Linux (diff) | |
download | ice-63a9b33d2a7cfa02c51d3fd26feb59d8a939cb91.tar.bz2 ice-63a9b33d2a7cfa02c51d3fd26feb59d8a939cb91.tar.xz ice-63a9b33d2a7cfa02c51d3fd26feb59d8a939cb91.zip |
Fixed ICE-7954 - bug in Object::ice_dispatch
Diffstat (limited to 'cpp/test')
-rw-r--r-- | cpp/test/Ice/interceptor/AMDInterceptorI.cpp | 50 | ||||
-rw-r--r-- | cpp/test/Ice/interceptor/MyObjectI.cpp | 2 |
2 files changed, 25 insertions, 27 deletions
diff --git a/cpp/test/Ice/interceptor/AMDInterceptorI.cpp b/cpp/test/Ice/interceptor/AMDInterceptorI.cpp index cfd3490288c..05fc80709e1 100644 --- a/cpp/test/Ice/interceptor/AMDInterceptorI.cpp +++ b/cpp/test/Ice/interceptor/AMDInterceptorI.cpp @@ -30,6 +30,9 @@ AMDInterceptorI::dispatch(Ice::Request& request) class CallbackI : public Ice::DispatchInterceptorAsyncCallback { public: + CallbackI() : _count(0) + { + } virtual bool response() { @@ -38,6 +41,7 @@ AMDInterceptorI::dispatch(Ice::Request& request) virtual bool exception(const std::exception& ex) { + test(_count++ == 0); // Ensure it's only called once test(dynamic_cast<const Test::RetryException*>(&ex) != 0); return false; } @@ -50,8 +54,11 @@ AMDInterceptorI::dispatch(Ice::Request& request) test(false); return false; } + + private: + + int _count; }; - Ice::DispatchInterceptorAsyncCallbackPtr cb = ICE_MAKE_SHARED(CallbackI); #endif Ice::Current& current = const_cast<Ice::Current&>(request.getCurrent()); @@ -61,34 +68,25 @@ AMDInterceptorI::dispatch(Ice::Request& request) { for(int i = 0; i < 10; ++i) { - try - { #ifdef ICE_CPP11_MAPPING - _lastStatus = _servant->ice_dispatch(request, nullptr, [](exception_ptr ex) { - try - { - rethrow_exception(ex); - } - catch(Test::RetryException&) - { - } - catch(...) - { - test(false); - } - return false; - }); + _lastStatus = _servant->ice_dispatch(request, nullptr, [](exception_ptr ex) { + try + { + rethrow_exception(ex); + } + catch(Test::RetryException&) + { + } + catch(...) + { + test(false); + } + return false; + }); #else - _lastStatus = _servant->ice_dispatch(request, cb); + _lastStatus = _servant->ice_dispatch(request, new CallbackI()); #endif - test(_lastStatus); - } - catch(const Test::RetryException&) - { - // - // Expected, retry - // - } + test(!_lastStatus); } current.ctx["retry"] = "no"; diff --git a/cpp/test/Ice/interceptor/MyObjectI.cpp b/cpp/test/Ice/interceptor/MyObjectI.cpp index a452568dbcb..02e009fd51e 100644 --- a/cpp/test/Ice/interceptor/MyObjectI.cpp +++ b/cpp/test/Ice/interceptor/MyObjectI.cpp @@ -258,7 +258,7 @@ MyObjectI::amdAddWithRetry_async(const Test::AMD_MyObject_amdAddWithRetryPtr& cb if(p == current.ctx.end() || p->second != "no") { - throw Test::RetryException(__FILE__, __LINE__); + cb->ice_exception(Test::RetryException(__FILE__, __LINE__)); } } |