You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gs...@apache.org on 2013/10/31 15:09:13 UTC

svn commit: r1537496 - /qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Session.cpp

Author: gsim
Date: Thu Oct 31 14:09:12 2013
New Revision: 1537496

URL: http://svn.apache.org/r1537496
Log:
QPID-5279: checks for exclusivity in linking to queue

Modified:
    qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Session.cpp

Modified: qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Session.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Session.cpp?rev=1537496&r1=1537495&r2=1537496&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Session.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Session.cpp Thu Oct 31 14:09:12 2013
@@ -284,10 +284,13 @@ Session::ResolvedNode Session::resolve(c
         }
     }
 
-    if (node.properties.isExclusive() && node.queue && node.queue->setExclusiveOwner(this)) {
-        exclusiveQueues.insert(node.queue);
+    if (node.properties.isExclusive() && node.queue) {
+        if (node.queue->setExclusiveOwner(this)) {
+            exclusiveQueues.insert(node.queue);
+        } else {
+            throw Exception(qpid::amqp::error_conditions::PRECONDITION_FAILED, std::string("Cannot grant exclusive access to ") + node.queue->getName());
+        }
     }
-
     return node;
 }
 
@@ -417,6 +420,9 @@ void Session::setupOutgoing(pn_link_t* l
     if (node.queue) {
         authorise.outgoing(node.queue);
         SubscriptionType type = pn_terminus_get_distribution_mode(source) == PN_DIST_MODE_COPY ? BROWSER : CONSUMER;
+        if (type == CONSUMER && node.queue->hasExclusiveOwner() && !node.queue->isExclusiveOwner(this)) {
+            throw Exception(qpid::amqp::error_conditions::PRECONDITION_FAILED, std::string("Cannot consume from exclusive queue ") + node.queue->getName());
+        }
         boost::shared_ptr<Outgoing> q(new OutgoingFromQueue(connection.getBroker(), name, target, node.queue, link, *this, out, type, false, node.properties.trackControllingLink()));
         q->init();
         filter.apply(q);



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