summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Anthony Giusti <kgiusti@apache.org>2012-05-01 13:57:39 +0000
committerKenneth Anthony Giusti <kgiusti@apache.org>2012-05-01 13:57:39 +0000
commit59b772b3de00eda9f0d6a1d3fc13856cadba25fd (patch)
tree648a09b595eec932664142f77f0272843150946c
parent17895350191c5bfdbefbd1d5919d300abab2db57 (diff)
downloadqpid-python-59b772b3de00eda9f0d6a1d3fc13856cadba25fd.tar.gz
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
-rw-r--r--qpid/cpp/src/qpid/broker/Link.cpp12
-rw-r--r--qpid/cpp/src/qpid/broker/Link.h1
2 files changed, 5 insertions, 8 deletions
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<sys::TimerTask> timerTask;
boost::shared_ptr<broker::LinkExchange> 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;