summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/client/ConnectionHandler.cpp
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
commita9a2e91cdba870df5ae91e8f9c6734a947a97841 (patch)
treebcf8cad2bc14d5fd156a220f3c5768fd4dcc3b1f /cpp/src/qpid/client/ConnectionHandler.cpp
parent9b6a2cdd7751b8718f1ac6e6c31225591b785083 (diff)
downloadqpid-python-a9a2e91cdba870df5ae91e8f9c6734a947a97841.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/qpid@713739 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/client/ConnectionHandler.cpp')
-rw-r--r--cpp/src/qpid/client/ConnectionHandler.cpp7
1 files changed, 5 insertions, 2 deletions
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);