summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src')
-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;