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.cpp45
1 files changed, 28 insertions, 17 deletions
diff --git a/cpp/src/Ice/ConnectRequestHandler.cpp b/cpp/src/Ice/ConnectRequestHandler.cpp
index a8e83697996..10f756be30c 100644
--- a/cpp/src/Ice/ConnectRequestHandler.cpp
+++ b/cpp/src/Ice/ConnectRequestHandler.cpp
@@ -287,25 +287,37 @@ ConnectRequestHandler::asyncRequestTimedOut(const OutgoingAsyncMessageCallbackPt
}
Ice::ConnectionIPtr
-ConnectRequestHandler::getConnection(bool waitInit)
+ConnectRequestHandler::getConnection()
{
Lock sync(*this);
- if(waitInit)
+ if(_exception.get())
{
- if(_exception.get())
- {
- throw RetryException(*_exception.get());
- }
-
- //
- // Wait for the connection establishment to complete or fail.
- //
- while(!_initialized && !_exception.get())
- {
- wait();
- }
+ _exception->ice_throw();
+ return 0; // Keep the compiler happy.
+ }
+ else
+ {
+ return _connection;
+ }
+}
+
+Ice::ConnectionIPtr
+ConnectRequestHandler::waitForConnection()
+{
+ Lock sync(*this);
+ if(_exception.get())
+ {
+ throw RetryException(*_exception.get());
}
-
+
+ //
+ // Wait for the connection establishment to complete or fail.
+ //
+ while(!_initialized && !_exception.get())
+ {
+ wait();
+ }
+
if(_exception.get())
{
_exception->ice_throw();
@@ -313,9 +325,8 @@ ConnectRequestHandler::getConnection(bool waitInit)
}
else
{
- assert(!waitInit || _initialized);
return _connection;
- }
+ }
}
void