From b6eb88609aea82e676f33ae8ff68918b68b81d33 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Mon, 26 Oct 2009 20:11:08 +0000 Subject: Separate FailoverListener from client::Connection. client::ConnectionImpl used to contain a FailoverListener to subscribe for updates on the amq.failover exchange. This caused some lifecycle issues including memory leaks. Now FailoverListener is a public API class that the user must create associated with a session to get known-broker updates. Removed the weak_ptr logic in client::SessionImpl which was only required because of FailoverListener. Made SessionImpl::close() idempotent. Gets rid of spurious warning messages in some tests. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@829931 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/client/ConnectionImpl.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'cpp/src/qpid/client/ConnectionImpl.cpp') diff --git a/cpp/src/qpid/client/ConnectionImpl.cpp b/cpp/src/qpid/client/ConnectionImpl.cpp index 6a46cb6249..c48a580fe8 100644 --- a/cpp/src/qpid/client/ConnectionImpl.cpp +++ b/cpp/src/qpid/client/ConnectionImpl.cpp @@ -22,7 +22,6 @@ #include "qpid/client/Connector.h" #include "qpid/client/ConnectionSettings.h" #include "qpid/client/SessionImpl.h" -#include "qpid/client/FailoverListener.h" #include "qpid/log/Statement.h" #include "qpid/Url.h" @@ -88,7 +87,6 @@ ConnectionImpl::~ConnectionImpl() { // Important to close the connector first, to ensure the // connector thread does not call on us while the destructor // is running. - failover.reset(); if (connector) connector->close(); } @@ -175,7 +173,6 @@ void ConnectionImpl::open() } else { QPID_LOG(debug, "No security layer in place"); } - failover.reset(new FailoverListener(shared_from_this(), handler.knownBrokersUrls)); } void ConnectionImpl::idleIn() @@ -256,8 +253,8 @@ const ConnectionSettings& ConnectionImpl::getNegotiatedSettings() return handler; } -std::vector ConnectionImpl::getKnownBrokers() { - return failover ? failover->getKnownBrokers() : handler.knownBrokersUrls; +std::vector ConnectionImpl::getInitialBrokers() { + return handler.knownBrokersUrls; } boost::shared_ptr ConnectionImpl::newSession(const std::string& name, uint32_t timeout, uint16_t channel) { @@ -267,6 +264,4 @@ boost::shared_ptr ConnectionImpl::newSession(const std::string& na return simpl; } -void ConnectionImpl::stopFailoverListener() { failover->stop(); } - }} // namespace qpid::client -- cgit v1.2.1