diff options
author | Jose <jose@zeroc.com> | 2011-12-08 20:04:00 +0100 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2011-12-08 20:04:00 +0100 |
commit | 8852a7b5dec7922e45f165aef4d265dce8641e9e (patch) | |
tree | fcabded6c62fdd1bf209afc03a9333eec3240d89 /cpp/src | |
parent | .NET CF performance issues patch (diff) | |
download | ice-8852a7b5dec7922e45f165aef4d265dce8641e9e.tar.bz2 ice-8852a7b5dec7922e45f165aef4d265dce8641e9e.tar.xz ice-8852a7b5dec7922e45f165aef4d265dce8641e9e.zip |
4711 - Only initiate connection shutdown if not already done
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Ice/ConnectionI.cpp | 21 | ||||
-rw-r--r-- | cpp/src/Ice/ConnectionI.h | 1 |
2 files changed, 20 insertions, 2 deletions
diff --git a/cpp/src/Ice/ConnectionI.cpp b/cpp/src/Ice/ConnectionI.cpp index 34317d920ee..2afd650ed26 100644 --- a/cpp/src/Ice/ConnectionI.cpp +++ b/cpp/src/Ice/ConnectionI.cpp @@ -1489,9 +1489,22 @@ ConnectionI::dispatch(const StartCallbackPtr& startCB, const vector<OutgoingAsyn { if(_state == StateClosing) { + // + // Only initiate shutdown if not already done. It + // might have already been done if the sent callback + // or AMI callback was dispatched when the connection + // was already in the closing state. + // try { - initiateShutdown(); + if(!_shutdownInitiated) + { + initiateShutdown(); + } + else + { + setState(StateClosed); + } } catch(const LocalException& ex) { @@ -1771,7 +1784,8 @@ Ice::ConnectionI::ConnectionI(const InstancePtr& instance, _readHeader(false), _writeStream(_instance.get()), _dispatchCount(0), - _state(StateNotInitialized) + _state(StateNotInitialized), + _shutdownInitiated(false) { int& compressionLevel = const_cast<int&>(_compressionLevel); @@ -2056,6 +2070,9 @@ Ice::ConnectionI::initiateShutdown() { assert(_state == StateClosing); assert(_dispatchCount == 0); + assert(!_shutdownInitiated); + + _shutdownInitiated = true; if(!_endpoint->datagram()) { diff --git a/cpp/src/Ice/ConnectionI.h b/cpp/src/Ice/ConnectionI.h index 0019ac1a7e8..c0ee9256c0b 100644 --- a/cpp/src/Ice/ConnectionI.h +++ b/cpp/src/Ice/ConnectionI.h @@ -323,6 +323,7 @@ private: int _dispatchCount; State _state; // The current state. + bool _shutdownInitiated; }; } |