summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp')
-rw-r--r--cpp/src/qpid/broker/Link.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/cpp/src/qpid/broker/Link.cpp b/cpp/src/qpid/broker/Link.cpp
index 08b9d8fe3e..630ce68150 100644
--- a/cpp/src/qpid/broker/Link.cpp
+++ b/cpp/src/qpid/broker/Link.cpp
@@ -102,9 +102,11 @@ void Link::setStateLH (int newState)
void Link::startConnectionLH ()
{
try {
+ // Set the state before calling connect. It is possible that connect
+ // will fail synchronously and call Link::closed before returning.
+ setStateLH(STATE_CONNECTING);
broker->connect (host, port, useSsl,
boost::bind (&Link::closed, this, _1, _2));
- setStateLH(STATE_CONNECTING);
} catch(std::exception& e) {
setStateLH(STATE_WAITING);
mgmtObject->set_lastError (e.what());