diff options
author | Ted Ross <tross@apache.org> | 2008-11-11 20:54:00 +0000 |
---|---|---|
committer | Ted Ross <tross@apache.org> | 2008-11-11 20:54:00 +0000 |
commit | c118b395ce2c025683e485ec5c37b62c4ef650a8 (patch) | |
tree | eb185a5a18999649bcc6230e7f213f9d13114cbd /cpp/src | |
parent | ebd80352a69db1717ebe2b62ff848b75c4ca5f22 (diff) | |
download | qpid-python-c118b395ce2c025683e485ec5c37b62c4ef650a8.tar.gz |
Fixed a violation of the lock hierarchy in LinkRegistry and Link
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@713161 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/qpid/broker/Link.cpp | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/cpp/src/qpid/broker/Link.cpp b/cpp/src/qpid/broker/Link.cpp index d2886050dd..b026c89b75 100644 --- a/cpp/src/qpid/broker/Link.cpp +++ b/cpp/src/qpid/broker/Link.cpp @@ -160,36 +160,37 @@ void Link::closed (int, std::string text) void Link::destroy () { - Mutex::ScopedLock mutex(lock); - Bridges toDelete; - - 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"); - } + { + Mutex::ScopedLock mutex(lock); + Bridges toDelete; - QPID_LOG (info, "Inter-broker link to " << host << ":" << port << " removed by management"); - if (connection) - connection->close(CLOSE_CODE_CONNECTION_FORCED, "closed by management"); + 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"); + } - setStateLH(STATE_CLOSED); + QPID_LOG (info, "Inter-broker link to " << host << ":" << port << " removed by management"); + if (connection) + connection->close(CLOSE_CODE_CONNECTION_FORCED, "closed by management"); - // Move the bridges to be deleted into a local vector so there is no - // corruption of the iterator caused by bridge deletion. - for (Bridges::iterator i = active.begin(); i != active.end(); i++) - toDelete.push_back(*i); - active.clear(); + setStateLH(STATE_CLOSED); - for (Bridges::iterator i = created.begin(); i != created.end(); i++) - toDelete.push_back(*i); - created.clear(); + // Move the bridges to be deleted into a local vector so there is no + // corruption of the iterator caused by bridge deletion. + for (Bridges::iterator i = active.begin(); i != active.end(); i++) + toDelete.push_back(*i); + active.clear(); - // Now delete all bridges on this link. - for (Bridges::iterator i = toDelete.begin(); i != toDelete.end(); i++) - (*i)->destroy(); - toDelete.clear(); + for (Bridges::iterator i = created.begin(); i != created.end(); i++) + toDelete.push_back(*i); + created.clear(); + // Now delete all bridges on this link. + for (Bridges::iterator i = toDelete.begin(); i != toDelete.end(); i++) + (*i)->destroy(); + toDelete.clear(); + } links->destroy (host, port); } |