From 59b772b3de00eda9f0d6a1d3fc13856cadba25fd Mon Sep 17 00:00:00 2001 From: Kenneth Anthony Giusti Date: Tue, 1 May 2012 13:57:39 +0000 Subject: QPID-3963: use unique name for created session and queue git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1332656 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/broker/Link.cpp | 12 ++++-------- qpid/cpp/src/qpid/broker/Link.h | 1 + 2 files changed, 5 insertions(+), 8 deletions(-) (limited to 'qpid/cpp/src') diff --git a/qpid/cpp/src/qpid/broker/Link.cpp b/qpid/cpp/src/qpid/broker/Link.cpp index 653601e7e4..d416789572 100644 --- a/qpid/cpp/src/qpid/broker/Link.cpp +++ b/qpid/cpp/src/qpid/broker/Link.cpp @@ -262,11 +262,6 @@ void Link::setUrl(const Url& u) { namespace { /** invoked when session used to subscribe to remote's amq.failover exchange detaches */ void sessionDetached(Link *link) { - // ??? really not sure what the right thing to do here, if anything... - // ??? Q: do I need to cancel the subscription and detached the session in the I/O thread (???) - // e.g: - //peer->getMessage().cancel(args.i_dest); - //peer->getSession().detach(name); QPID_LOG(debug, "detached from 'amq.failover' for link: " << link->getName()); } } @@ -290,12 +285,13 @@ void Link::opened() { // attempt to subscribe to failover exchange for updates from remote // - const std::string queueName = "qpid.link." + failoverExchange->getName(); + const std::string queueName = "qpid.link." + framing::Uuid(true).str(); failoverChannel = nextChannel(); SessionHandler& sessionHandler = connection->getChannel(failoverChannel); sessionHandler.setDetachedCallback( boost::bind(&sessionDetached, this) ); - sessionHandler.attachAs(failoverExchange->getName()); + failoverSession = queueName; + sessionHandler.attachAs(failoverSession); framing::AMQP_ServerProxy remoteBroker(sessionHandler.out); @@ -673,7 +669,7 @@ void Link::closeConnection( const std::string& reason) if (sessionHandler.getSession()) { framing::AMQP_ServerProxy remoteBroker(sessionHandler.out); remoteBroker.getMessage().cancel(failoverExchange->getName()); - remoteBroker.getSession().detach(failoverExchange->getName()); + remoteBroker.getSession().detach(failoverSession); } connection->close(CLOSE_CODE_CONNECTION_FORCED, reason); connection = 0; diff --git a/qpid/cpp/src/qpid/broker/Link.h b/qpid/cpp/src/qpid/broker/Link.h index 27e9f466f5..5025aba678 100644 --- a/qpid/cpp/src/qpid/broker/Link.h +++ b/qpid/cpp/src/qpid/broker/Link.h @@ -88,6 +88,7 @@ class Link : public PersistableConfig, public management::Manageable { boost::intrusive_ptr timerTask; boost::shared_ptr failoverExchange; // subscribed to remote's amq.failover exchange uint failoverChannel; + std::string failoverSession; static const int STATE_WAITING = 1; static const int STATE_CONNECTING = 2; -- cgit v1.2.1