qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject svn commit: r810094 - in /qpid/trunk/qpid: cpp/src/qpid/broker/Connection.cpp python/tests_0-10/management.py
Date Tue, 01 Sep 2009 15:22:49 GMT
Author: gsim
Date: Tue Sep  1 15:22:48 2009
New Revision: 810094

URL: http://svn.apache.org/viewvc?rev=810094&view=rev
Log:
QPID-2078: Ensure sessions are cleaned up when their connection is closed by management.


Modified:
    qpid/trunk/qpid/cpp/src/qpid/broker/Connection.cpp
    qpid/trunk/qpid/python/tests_0-10/management.py

Modified: qpid/trunk/qpid/cpp/src/qpid/broker/Connection.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/Connection.cpp?rev=810094&r1=810093&r2=810094&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/Connection.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/Connection.cpp Tue Sep  1 15:22:48 2009
@@ -269,11 +269,13 @@
                 cb(); // Lend the IO thread for management processing
             }
         }
-        if (mgmtClosing)
+        if (mgmtClosing) {
+            closed();
             close(connection::CLOSE_CODE_CONNECTION_FORCED, "Closed by Management Request");
-        else
+        } else {
             //then do other output as needed:
             return outputTasks.doOutput();
+	}
     }catch(ConnectionException& e){
         close(e.code, e.getMessage());
     }catch(std::exception& e){

Modified: qpid/trunk/qpid/python/tests_0-10/management.py
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/python/tests_0-10/management.py?rev=810094&r1=810093&r2=810094&view=diff
==============================================================================
--- qpid/trunk/qpid/python/tests_0-10/management.py (original)
+++ qpid/trunk/qpid/python/tests_0-10/management.py Tue Sep  1 15:22:48 2009
@@ -295,3 +295,25 @@
         sleep(1)
         self.assertEqual(handler.check(), "pass")
 
+    def test_connection_close(self):
+        """
+        Test management method for closing connection
+        """
+        self.startQmf()
+        conn = self.connect()
+        session = conn.session("my-named-session")
+
+        #using qmf find named session and close the corresponding connection:
+        qmf_ssn_object = self.qmf.getObjects(_class="session", name="my-named-session")[0]
+        qmf_ssn_object._connectionRef_.close()
+
+        #check that connection is closed
+        try:
+            conn.session("another-session")
+            self.fail("Expected failure from closed connection")
+        except: None
+        
+        #make sure that the named session has been closed and the name can be re-used
+        conn = self.connect()
+        session = conn.session("my-named-session")
+        session.queue_declare(queue="whatever", exclusive=True, auto_delete=True)



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message