diff options
author | Gordon Sim <gsim@apache.org> | 2010-08-20 09:29:31 +0000 |
---|---|---|
committer | Gordon Sim <gsim@apache.org> | 2010-08-20 09:29:31 +0000 |
commit | 91a4eda9bfa588f1d017c218ac2bcc9713338ef2 (patch) | |
tree | ac6e1293404f93a7b14b88fc5eab3fa4a51e033e /cpp/src/qpid/client/ConnectionHandler.cpp | |
parent | 6217978d75d7c80f3069e5c39a85f32d744f70e1 (diff) | |
download | qpid-python-91a4eda9bfa588f1d017c218ac2bcc9713338ef2.tar.gz |
QPID-2817: on close, wait for at most the heartbeat interval (if specified) for close-ok response from broker
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@987429 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/client/ConnectionHandler.cpp')
-rw-r--r-- | cpp/src/qpid/client/ConnectionHandler.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/cpp/src/qpid/client/ConnectionHandler.cpp b/cpp/src/qpid/client/ConnectionHandler.cpp index ba15e635cf..e615878703 100644 --- a/cpp/src/qpid/client/ConnectionHandler.cpp +++ b/cpp/src/qpid/client/ConnectionHandler.cpp @@ -157,7 +157,14 @@ void ConnectionHandler::close() case OPEN: if (setState(CLOSING, OPEN)) { proxy.close(200, OK); - waitFor(FINISHED);//FINISHED = CLOSED or FAILED + if (ConnectionSettings::heartbeat) { + //heartbeat timer is turned off at this stage, so don't wait indefinately + if (!waitFor(FINISHED, qpid::sys::Duration(ConnectionSettings::heartbeat * qpid::sys::TIME_SEC))) { + QPID_LOG(warning, "Connection close timed out"); + } + } else { + waitFor(FINISHED);//FINISHED = CLOSED or FAILED + } } //else, state was changed from open after we checked, can only //change to failed or closed, so nothing to do |