summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2009-08-12 11:12:16 +0000
committerGordon Sim <gsim@apache.org>2009-08-12 11:12:16 +0000
commit165df218ea63d83fe661fc403c2a01839a62f853 (patch)
tree1ce9b279e5edce19c78d30ec61612b087c6458b8
parent228cf1db5a2e64ec026cc901fdcc44647ad20232 (diff)
downloadqpid-python-165df218ea63d83fe661fc403c2a01839a62f853.tar.gz
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 git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@803449 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--cpp/src/qpid/broker/Link.cpp29
-rw-r--r--cpp/src/qpid/broker/Link.h3
2 files changed, 22 insertions, 10 deletions
diff --git a/cpp/src/qpid/broker/Link.cpp b/cpp/src/qpid/broker/Link.cpp
index 061e627f47..d2ecb9dd52 100644
--- a/cpp/src/qpid/broker/Link.cpp
+++ b/cpp/src/qpid/broker/Link.cpp
@@ -174,18 +174,24 @@ void Link::closed (int, std::string text)
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 @@ Manageable::status_t Link::ManagementMethod (uint32_t op, Args& args, string& te
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 :
diff --git a/cpp/src/qpid/broker/Link.h b/cpp/src/qpid/broker/Link.h
index 12f03095f0..318eb5bd32 100644
--- a/cpp/src/qpid/broker/Link.h
+++ b/cpp/src/qpid/broker/Link.h
@@ -85,7 +85,8 @@ namespace qpid {
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;