summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/ConnectRequestHandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/Ice/ConnectRequestHandler.cpp')
-rw-r--r--cpp/src/Ice/ConnectRequestHandler.cpp15
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