From 656a4f3d5fcea275f954e3d1c9eaa5087a2e7005 Mon Sep 17 00:00:00 2001 From: Ted Ross Date: Wed, 4 Jun 2008 16:52:26 +0000 Subject: QPID-1121 git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@663304 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/broker/Link.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'cpp/src') 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()); -- cgit v1.2.1