From 91a4eda9bfa588f1d017c218ac2bcc9713338ef2 Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Fri, 20 Aug 2010 09:29:31 +0000 Subject: 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 --- cpp/src/qpid/client/ConnectionHandler.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'cpp/src/qpid/client/ConnectionHandler.cpp') 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 -- cgit v1.2.1