qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject svn commit: r803449 - in /qpid/trunk/qpid/cpp/src/qpid/broker: Link.cpp Link.h
Date Wed, 12 Aug 2009 11:12:17 GMT
Author: gsim
Date: Wed Aug 12 11:12:16 2009
New Revision: 803449

URL: http://svn.apache.org/viewvc?rev=803449&view=rev
Log:
QPID-2046: * perform destroy() on the links own io thread, not on that of the management connection
issuingthe request
           * move ACL check such that it only applies to the management operation


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=803449&r1=803448&r2=803449&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/Link.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/Link.cpp Wed Aug 12 11:12:16 2009
@@ -174,18 +174,24 @@
         destroy();
 }
 
+void Link::checkClosePermission()
+{
+    Mutex::ScopedLock mutex(lock);
+    
+    AclModule* acl = getBroker()->getAcl();
+    std::string userID = getUsername() + "@" + getBroker()->getOptions().realm;
+    if (acl && !acl->authorise(userID,acl::ACT_DELETE,acl::OBJ_LINK,"")){
+        throw NotAllowedException("ACL denied delete link request");
+    }
+}
+
+
 void Link::destroy ()
 {
     Bridges toDelete;
     {
         Mutex::ScopedLock mutex(lock);
 
-        AclModule* acl = getBroker()->getAcl();
-        std::string userID = getUsername() + "@" + getBroker()->getOptions().realm;
-        if (acl && !acl->authorise(userID,acl::ACT_DELETE,acl::OBJ_LINK,"")){
-            throw NotAllowedException("ACL denied delete link request");
-        }
-
         QPID_LOG (info, "Inter-broker link to " << host << ":" << port
<< " removed by management");
         if (connection)
             connection->close(CLOSE_CODE_CONNECTION_FORCED, "closed by management");
@@ -412,9 +418,14 @@
     switch (op)
     {
     case _qmf::Link::METHOD_CLOSE :
-        closing = true;
-        if (state != STATE_CONNECTING)
-            destroy();
+        checkClosePermission();
+	if (!closing) {
+	    closing = true;
+	    if (state != STATE_CONNECTING && connection) {
+                //connection can only be closed on the connections own IO processing thread
+                connection->requestIOProcessing(boost::bind(&Link::destroy, this));
+	    }
+        }
         return Manageable::STATUS_OK;
 
     case _qmf::Link::METHOD_BRIDGE :

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=803449&r1=803448&r2=803449&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/Link.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/Link.h Wed Aug 12 11:12:16 2009
@@ -85,7 +85,8 @@
             void startConnectionLH();        // Start the IO Connection
             void destroy();                  // Called when mgmt deletes this link
             void ioThreadProcessing();       // Called on connection's IO thread by request
-            bool tryFailover();               // Called during maintenance visit
+            bool tryFailover();              // Called during maintenance visit
+            void checkClosePermission();     // ACL check for explict mgmt call to close
this link
 
         public:
             typedef boost::shared_ptr<Link> shared_ptr;



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message