From 5426e8284e8f7e1454a8cb0462b91c6c60c722bc Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Wed, 26 Sep 2007 10:51:12 +0000 Subject: Detect that connection is already closed on attempt to close() git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@579582 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/client/ConnectionHandler.cpp | 3 +++ 1 file changed, 3 insertions(+) (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 40e13593ea..4058bfb33f 100644 --- a/cpp/src/qpid/client/ConnectionHandler.cpp +++ b/cpp/src/qpid/client/ConnectionHandler.cpp @@ -102,6 +102,9 @@ void ConnectionHandler::waitForOpen() void ConnectionHandler::close() { + if (getState() != OPEN) { + throw Exception("Connection not open"); + } setState(CLOSING); send(ConnectionCloseBody(version, 200, OK, 0, 0)); waitFor(CLOSED); -- cgit v1.2.1