summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2008-11-13 14:48:44 +0000
committerGordon Sim <gsim@apache.org>2008-11-13 14:48:44 +0000
commit84cd555a220a48737adb78154de4adbb2ac6d1e1 (patch)
treef8c178545d522eebc9e91ca0ed7e2dd16d143954
parent0c7f79bbd58aaa23863f200abbf4edf9f247f370 (diff)
downloadqpid-python-84cd555a220a48737adb78154de4adbb2ac6d1e1.tar.gz
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@713739 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/cpp/src/qpid/client/ConnectionHandler.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/qpid/cpp/src/qpid/client/ConnectionHandler.cpp b/qpid/cpp/src/qpid/client/ConnectionHandler.cpp
index fc53499fc5..db5d006a17 100644
--- a/qpid/cpp/src/qpid/client/ConnectionHandler.cpp
+++ b/qpid/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);