From a2db316615b2ea92eb5ec00e3a1ef3887d097996 Mon Sep 17 00:00:00 2001 From: Kenneth Anthony Giusti Date: Fri, 25 May 2012 18:30:48 +0000 Subject: NO-JIRA: eliminate dead code and potential null pointer dereference as found by Coverity git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1342759 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/broker/Link.cpp | 42 ++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/qpid/cpp/src/qpid/broker/Link.cpp b/qpid/cpp/src/qpid/broker/Link.cpp index ab28c5b01f..e354b4e425 100644 --- a/qpid/cpp/src/qpid/broker/Link.cpp +++ b/qpid/cpp/src/qpid/broker/Link.cpp @@ -345,36 +345,32 @@ void Link::opened() { void Link::closed(int, std::string text) { - bool isClosing = false; - { - Mutex::ScopedLock mutex(lock); - QPID_LOG (info, "Inter-broker link disconnected from " << host << ":" << port << " " << text); + Mutex::ScopedLock mutex(lock); + QPID_LOG (info, "Inter-broker link disconnected from " << host << ":" << port << " " << text); - connection = 0; - if (state == STATE_OPERATIONAL) { + connection = 0; + + if (!hideManagement()) { + mgmtObject->set_connectionRef(qpid::management::ObjectId()); + if (state == STATE_OPERATIONAL && agent) { stringstream addr; addr << host << ":" << port; - if (!hideManagement() && agent) - agent->raiseEvent(_qmf::EventBrokerLinkDown(addr.str())); + agent->raiseEvent(_qmf::EventBrokerLinkDown(addr.str())); } + } - for (Bridges::iterator i = active.begin(); i != active.end(); i++) { - (*i)->closed(); - created.push_back(*i); - } - active.clear(); + for (Bridges::iterator i = active.begin(); i != active.end(); i++) { + (*i)->closed(); + created.push_back(*i); + } + active.clear(); - if (state != STATE_FAILED && state != STATE_PASSIVE) - { - setStateLH(STATE_WAITING); - if (!hideManagement()) - mgmtObject->set_lastError (text); - } - mgmtObject->set_connectionRef(qpid::management::ObjectId()); + if (state != STATE_FAILED && state != STATE_PASSIVE) + { + setStateLH(STATE_WAITING); + if (!hideManagement()) + mgmtObject->set_lastError (text); } - // Call destroy outside of the lock, don't want to be deleted with lock held. - if (isClosing) - destroy(); } // Called in connection IO thread, cleans up the connection before destroying Link -- cgit v1.2.1