summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/qpid/client/ConnectionImpl.cpp10
-rw-r--r--cpp/src/tests/BrokerFixture.h1
-rw-r--r--cpp/src/tests/PartialFailure.cpp4
3 files changed, 11 insertions, 4 deletions
diff --git a/cpp/src/qpid/client/ConnectionImpl.cpp b/cpp/src/qpid/client/ConnectionImpl.cpp
index e4e7b2f5c2..4f35639c71 100644
--- a/cpp/src/qpid/client/ConnectionImpl.cpp
+++ b/cpp/src/qpid/client/ConnectionImpl.cpp
@@ -156,8 +156,14 @@ void ConnectionImpl::open()
handler.setRcvTimeoutTask(heartbeatTask);
theTimer().add(heartbeatTask);
}
-
- handler.waitForOpen();
+
+ try {
+ handler.waitForOpen();
+ } catch (...) {
+ // Make sure the connector thread is joined.
+ connector->close();
+ throw;
+ }
// If the SASL layer has provided an "operational" userId for the connection,
// put it in the negotiated settings.
diff --git a/cpp/src/tests/BrokerFixture.h b/cpp/src/tests/BrokerFixture.h
index 5eb6858491..566fbda406 100644
--- a/cpp/src/tests/BrokerFixture.h
+++ b/cpp/src/tests/BrokerFixture.h
@@ -94,6 +94,7 @@ struct BrokerFixture : private boost::noncopyable {
struct LocalConnection : public qpid::client::Connection {
LocalConnection(uint16_t port) { open("localhost", port); }
LocalConnection(const qpid::client::ConnectionSettings& s) { open(s); }
+ ~LocalConnection() { close(); }
};
/** A local client connection via a socket proxy. */
diff --git a/cpp/src/tests/PartialFailure.cpp b/cpp/src/tests/PartialFailure.cpp
index b5772607b2..21c6c5c724 100644
--- a/cpp/src/tests/PartialFailure.cpp
+++ b/cpp/src/tests/PartialFailure.cpp
@@ -98,8 +98,8 @@ QPID_AUTO_TEST_CASE(testCoincidentErrors) {
async(c1.session).messageTransfer(content=pMessage("TEST_STORE_DO: s1[exception]", "q"));
int alive=0;
- try { Client c00(cluster[0], "c00"); ++alive; } catch (...) {}
- try { Client c11(cluster[1], "c11"); ++alive; } catch (...) {}
+ try { Client c00(cluster[0], "c00"); ++alive; c00.close(); } catch (...) {}
+ try { Client c11(cluster[1], "c11"); ++alive; c11.close(); } catch (...) {}
BOOST_CHECK_EQUAL(alive, 1);