diff options
author | Benoit Foucher <benoit@zeroc.com> | 2014-10-01 08:57:10 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2014-10-01 08:57:10 +0200 |
commit | 1411b8ab7c670e72a867ebbec283c0983622ea73 (patch) | |
tree | 823b647b81d61b3cb45e81b9b4753871fa5fbd99 /cpp/src/Ice/ConnectionI.cpp | |
parent | Fixed icegridadmin client default SSL port number for IceGrid (diff) | |
download | ice-1411b8ab7c670e72a867ebbec283c0983622ea73.tar.bz2 ice-1411b8ab7c670e72a867ebbec283c0983622ea73.tar.xz ice-1411b8ab7c670e72a867ebbec283c0983622ea73.zip |
Fixed Connection.setACM to check for the connection state
Diffstat (limited to 'cpp/src/Ice/ConnectionI.cpp')
-rw-r--r-- | cpp/src/Ice/ConnectionI.cpp | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/cpp/src/Ice/ConnectionI.cpp b/cpp/src/Ice/ConnectionI.cpp index 3d267e765a2..d52e0867124 100644 --- a/cpp/src/Ice/ConnectionI.cpp +++ b/cpp/src/Ice/ConnectionI.cpp @@ -1216,27 +1216,29 @@ Ice::ConnectionI::setACM(const IceUtil::Optional<int>& timeout, const IceUtil::Optional<Ice::ACMHeartbeat>& heartbeat) { IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); - if(_monitor) + if(!_monitor || _state >= StateClosed) { - if(_state == StateActive) - { - _monitor->remove(this); - } - _monitor = _monitor->acm(timeout, close, heartbeat); + return; + } - if(_monitor->getACM().timeout <= 0) - { - _acmLastActivity = IceUtil::Time(); // Disable the recording of last activity. - } - else if(_acmLastActivity == IceUtil::Time() && _state == StateActive) - { - _acmLastActivity = IceUtil::Time::now(IceUtil::Time::Monotonic); - } + if(_state == StateActive) + { + _monitor->remove(this); + } + _monitor = _monitor->acm(timeout, close, heartbeat); - if(_state == StateActive) - { - _monitor->add(this); - } + if(_monitor->getACM().timeout <= 0) + { + _acmLastActivity = IceUtil::Time(); // Disable the recording of last activity. + } + else if(_acmLastActivity == IceUtil::Time() && _state == StateActive) + { + _acmLastActivity = IceUtil::Time::now(IceUtil::Time::Monotonic); + } + + if(_state == StateActive) + { + _monitor->add(this); } } |