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.cpp26
1 files changed, 15 insertions, 11 deletions
diff --git a/cpp/src/Ice/ConnectRequestHandler.cpp b/cpp/src/Ice/ConnectRequestHandler.cpp
index 285402b333a..6bcb1bbc0c3 100644
--- a/cpp/src/Ice/ConnectRequestHandler.cpp
+++ b/cpp/src/Ice/ConnectRequestHandler.cpp
@@ -146,7 +146,7 @@ ConnectRequestHandler::setConnection(const Ice::ConnectionIPtr& connection, bool
{
{
Lock sync(*this);
- assert(!_exception && !_connection);
+ assert(!_flushing && !_exception && !_connection);
_connection = connection;
_compress = compress;
}
@@ -172,19 +172,15 @@ ConnectRequestHandler::setException(const Ice::LocalException& ex)
{
{
Lock sync(*this);
- assert(!_initialized && !_exception);
+ assert(!_flushing && !_initialized && !_exception);
+ _flushing = true; // Ensures request handler is removed before processing new requests.
ICE_SET_EXCEPTION_FROM_CLONE(_exception, ex.ice_clone());
-
- _proxies.clear();
- _proxy = 0; // Break cyclic reference count.
- notifyAll();
}
//
- // NOTE: remove the request handler *before* notifying the
- // requests that the connection failed. It's important to ensure
- // that future invocations will obtain a new connect request
- // handler once invocations are notified.
+ // NOTE: remove the request handler *before* notifying the requests that the connection
+ // failed. It's important to ensure that future invocations will obtain a new connect
+ // request handler once invocations are notified.
//
try
{
@@ -203,6 +199,14 @@ ConnectRequestHandler::setException(const Ice::LocalException& ex)
}
}
_requests.clear();
+
+ {
+ Lock sync(*this);
+ _flushing = false;
+ _proxies.clear();
+ _proxy = 0; // Break cyclic reference count.
+ notifyAll();
+ }
}
void
@@ -227,7 +231,7 @@ ConnectRequestHandler::initialized()
}
else
{
- while(_flushing && !_exception)
+ while(_flushing)
{
wait();
}