From a9a2e91cdba870df5ae91e8f9c6734a947a97841 Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Thu, 13 Nov 2008 14:48:44 +0000 Subject: Don't stop connector until close has been sent and close-ok received in response. (If necessary delay error notification until then). git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@713739 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/client/ConnectionHandler.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'cpp/src') diff --git a/cpp/src/qpid/client/ConnectionHandler.cpp b/cpp/src/qpid/client/ConnectionHandler.cpp index fc53499fc5..db5d006a17 100644 --- a/cpp/src/qpid/client/ConnectionHandler.cpp +++ b/cpp/src/qpid/client/ConnectionHandler.cpp @@ -93,8 +93,9 @@ void ConnectionHandler::incoming(AMQFrame& frame) }catch(std::exception& e){ QPID_LOG(warning, "Closing connection due to " << e.what()); setState(CLOSING); + errorCode = CLOSE_CODE_FRAMING_ERROR; + errorText = e.what(); proxy.close(501, e.what()); - if (onError) onError(501, e.what()); } } @@ -203,7 +204,9 @@ void ConnectionHandler::close(uint16_t replyCode, const std::string& replyText) void ConnectionHandler::closeOk() { checkState(CLOSING, INVALID_STATE_CLOSE_OK); - if (onClose) { + if (onError && errorCode != CLOSE_CODE_NORMAL) { + onError(errorCode, errorText); + } else if (onClose) { onClose(); } setState(CLOSED); -- cgit v1.2.1