Author: kgiusti
Date: Tue May  1 13:57:39 2012
New Revision: 1332656

URL: http://svn.apache.org/viewvc?rev=1332656&view=rev
Log:
QPID-3963: use unique name for created session and queue

Modified:
    qpid/trunk/qpid/cpp/src/qpid/broker/Link.cpp
    qpid/trunk/qpid/cpp/src/qpid/broker/Link.h

Modified: qpid/trunk/qpid/cpp/src/qpid/broker/Link.cpp
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/Link.cpp?rev=1332656&r1=1332655&r2=1332656&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/Link.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/Link.cpp Tue May  1 13:57:39 2012
@@ -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::s
         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;

Modified: qpid/trunk/qpid/cpp/src/qpid/broker/Link.h
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/Link.h?rev=1332656&r1=1332655&r2=1332656&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/Link.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/Link.h Tue May  1 13:57:39 2012
@@ -88,6 +88,7 @@ class Link : public PersistableConfig, p
     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;



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org
For additional commands, e-mail: commits-h...@qpid.apache.org

Reply via email to