Author: kgiusti
Date: Fri May 25 18:30:48 2012
New Revision: 1342759

URL: http://svn.apache.org/viewvc?rev=1342759&view=rev
Log:
NO-JIRA: eliminate dead code and potential null pointer dereference as found by 
Coverity

Modified:
    qpid/trunk/qpid/cpp/src/qpid/broker/Link.cpp

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=1342759&r1=1342758&r2=1342759&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/Link.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/Link.cpp Fri May 25 18:30:48 2012
@@ -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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to