diff options
author | Benoit Foucher <benoit@zeroc.com> | 2017-09-06 23:02:34 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2017-09-06 23:02:34 +0200 |
commit | 95520c8e5ffa5bfd41f3036f3a8de1f0a93667ec (patch) | |
tree | 93e6f4c8186450f06d7bc28cfdfee99c0c1c4f7f /cpp/src/Ice/ConnectRequestHandler.cpp | |
parent | Fix bogus reference use in communicatorDestroy (diff) | |
download | ice-95520c8e5ffa5bfd41f3036f3a8de1f0a93667ec.tar.bz2 ice-95520c8e5ffa5bfd41f3036f3a8de1f0a93667ec.tar.xz ice-95520c8e5ffa5bfd41f3036f3a8de1f0a93667ec.zip |
Ensure ice_getCachedConnection doesn't return null after successfully returning a connection
See bug ICE-8467
Diffstat (limited to 'cpp/src/Ice/ConnectRequestHandler.cpp')
-rw-r--r-- | cpp/src/Ice/ConnectRequestHandler.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/cpp/src/Ice/ConnectRequestHandler.cpp b/cpp/src/Ice/ConnectRequestHandler.cpp index 6bcb1bbc0c3..7e8f02257c5 100644 --- a/cpp/src/Ice/ConnectRequestHandler.cpp +++ b/cpp/src/Ice/ConnectRequestHandler.cpp @@ -103,15 +103,20 @@ Ice::ConnectionIPtr ConnectRequestHandler::getConnection() { Lock sync(*this); - if(_exception) + // + // First check for the connection, it's important otherwise the user could first get a connection + // and then the exception if he tries to obtain the proxy cached connection mutiple times (the + // exception can be set after the connection is set if the flush of pending requests fails). + // + if(_connection) { - _exception->ice_throw(); - return 0; // Keep the compiler happy. + return _connection; } - else + else if(_exception) { - return _connection; + _exception->ice_throw(); } + return ICE_NULLPTR; } Ice::ConnectionIPtr |