summaryrefslogtreecommitdiff
path: root/qpid/cpp
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2008-05-04 16:39:22 +0000
committerGordon Sim <gsim@apache.org>2008-05-04 16:39:22 +0000
commitc98dc9165d49845e1ec8b056b8969c135c8441d6 (patch)
tree06d66d6f2b19d29a7fb761dd1449806e5afbc27d /qpid/cpp
parent522e6ce436fd47d88a90f3248216a103b88095c1 (diff)
downloadqpid-python-c98dc9165d49845e1ec8b056b8969c135c8441d6.tar.gz
Fix error handling for connection close during startup.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@653248 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp')
-rw-r--r--qpid/cpp/src/qpid/client/ConnectionHandler.cpp2
-rw-r--r--qpid/cpp/src/qpid/client/ConnectionImpl.cpp3
2 files changed, 3 insertions, 2 deletions
diff --git a/qpid/cpp/src/qpid/client/ConnectionHandler.cpp b/qpid/cpp/src/qpid/client/ConnectionHandler.cpp
index 81d966d53f..df1afb87a9 100644
--- a/qpid/cpp/src/qpid/client/ConnectionHandler.cpp
+++ b/qpid/cpp/src/qpid/client/ConnectionHandler.cpp
@@ -170,9 +170,9 @@ void ConnectionHandler::redirect(const std::string& /*host*/, const Array& /*kno
void ConnectionHandler::close(uint16_t replyCode, const std::string& replyText)
{
proxy.closeOk();
- setState(CLOSED);
errorCode = replyCode;
errorText = replyText;
+ setState(CLOSED);
QPID_LOG(warning, "Broker closed connection: " << replyCode << ", " << replyText);
if (onError) {
onError(replyCode, replyText);
diff --git a/qpid/cpp/src/qpid/client/ConnectionImpl.cpp b/qpid/cpp/src/qpid/client/ConnectionImpl.cpp
index 643d42403d..67ae2293f1 100644
--- a/qpid/cpp/src/qpid/client/ConnectionImpl.cpp
+++ b/qpid/cpp/src/qpid/client/ConnectionImpl.cpp
@@ -48,12 +48,13 @@ ConnectionImpl::ConnectionImpl(framing::ProtocolVersion v, const ConnectionSetti
handler.out = boost::bind(&Connector::send, boost::ref(connector), _1);
handler.onClose = boost::bind(&ConnectionImpl::closed, this,
NORMAL, std::string());
- handler.onError = boost::bind(&ConnectionImpl::closed, this, _1, _2);
connector.setInputHandler(&handler);
connector.setTimeoutHandler(this);
connector.setShutdownHandler(this);
open(settings.host, settings.port);
+ //only set error handler once open
+ handler.onError = boost::bind(&ConnectionImpl::closed, this, _1, _2);
}
ConnectionImpl::~ConnectionImpl() {