diff options
Diffstat (limited to 'cppe/src')
-rwxr-xr-x | cppe/src/IceE/Connection.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/cppe/src/IceE/Connection.cpp b/cppe/src/IceE/Connection.cpp index 006406e0115..afe4a5210dd 100755 --- a/cppe/src/IceE/Connection.cpp +++ b/cppe/src/IceE/Connection.cpp @@ -119,6 +119,26 @@ Ice::Connection::close(bool force) } else { + // + // If we do a graceful shutdown, then we wait until all + // outstanding requests have been completed. Otherwise, the + // CloseConnectionException will cause all outstanding + // requests to be retried, regardless of whether the server + // has processed them or not. + // + // For consistency, we also wait until batch requests have + // completed, and, if this is a server connection, all + // requests have been dispatched. These are the same criteria + // that we use to determine whether ACM may close this + // connection. + // + while(!_requests.empty() || + _batchStreamInUse || !_batchStream.b.empty() || + _dispatchCount != 0) + { + wait(); + } + setState(StateClosing, CloseConnectionException(__FILE__, __LINE__)); } } |