From 5d07d177cfc5eca21c44981bbe342f0cdcced4e5 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Fri, 10 Oct 2008 04:49:48 +0000 Subject: QPID-1340 froM Mick Goulish: preliminary client-side failover support. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@703319 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/client/ConnectionImpl.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 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 910c908ee2..93eea50e43 100644 --- a/cpp/src/qpid/client/ConnectionImpl.cpp +++ b/cpp/src/qpid/client/ConnectionImpl.cpp @@ -151,13 +151,20 @@ static const std::string CONN_CLOSED("Connection closed by broker"); void ConnectionImpl::shutdown() { Mutex::ScopedLock l(lock); - if (handler.isClosed()) return; + if (handler.isClosed()) + { + std::cerr << "MDEBUG ConnectionImpl::shutdown -- returning w/o failure callback!\n"; + return; + } // FIXME aconway 2008-06-06: exception use, amqp0-10 does not seem to have // an appropriate close-code. connection-forced is not right. if (!handler.isClosing()) closeInternal(boost::bind(&SessionImpl::connectionBroke, _1, CLOSE_CODE_CONNECTION_FORCED, CONN_CLOSED)); setException(new ConnectionException(CLOSE_CODE_CONNECTION_FORCED, CONN_CLOSED)); handler.fail(CONN_CLOSED); + + if ( failureCallback ) + failureCallback(); } void ConnectionImpl::erase(uint16_t ch) { @@ -171,8 +178,8 @@ const ConnectionSettings& ConnectionImpl::getNegotiatedSettings() } std::vector ConnectionImpl::getKnownBrokers() { - // FIXME aconway 2008-10-08: initialize failover list from openOk or settings - return failover ? failover->getKnownBrokers() : std::vector(); + // FIXME aconway 2008-10-08: ensure we never return empty list, always include self Url. + return failover ? failover->getKnownBrokers() : handler.knownBrokersUrls; } boost::shared_ptr ConnectionImpl::newSession(const std::string& name, uint32_t timeout, uint16_t channel) { -- cgit v1.2.1