summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/client/ConnectionHandler.cpp
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2009-08-13 07:47:43 +0000
committerGordon Sim <gsim@apache.org>2009-08-13 07:47:43 +0000
commit0f4d8c56a1ad8804451ee6697186a6b0aa260e30 (patch)
tree14ced3a6cd69d091e7a9c5666437766658f694df /cpp/src/qpid/client/ConnectionHandler.cpp
parentba38bd2fc68d0d11574e0b00c3c79439cde3a66c (diff)
downloadqpid-python-0f4d8c56a1ad8804451ee6697186a6b0aa260e30.tar.gz
QPID-2048: Handle connection fail while attempting to close.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@803802 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/client/ConnectionHandler.cpp')
-rw-r--r--cpp/src/qpid/client/ConnectionHandler.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/cpp/src/qpid/client/ConnectionHandler.cpp b/cpp/src/qpid/client/ConnectionHandler.cpp
index 3d338af920..9b2f662c8e 100644
--- a/cpp/src/qpid/client/ConnectionHandler.cpp
+++ b/cpp/src/qpid/client/ConnectionHandler.cpp
@@ -147,11 +147,15 @@ void ConnectionHandler::close()
fail("Connection closed before it was established");
break;
case OPEN:
- setState(CLOSING);
- proxy.close(200, OK);
- waitFor(FINISHED);
+ if (setState(CLOSING, OPEN)) {
+ proxy.close(200, OK);
+ 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
break;
- // Nothing to do for CLOSING, CLOSED, FAILED or NOT_STARTED
+
+ // Nothing to do if already CLOSING, CLOSED, FAILED or if NOT_STARTED
}
}