[Neo-report] r2124 vincent - in /trunk/neo: dispatcher.py tests/testDispatcher.py

nobody at svn.erp5.org nobody at svn.erp5.org
Mon May 24 21:25:34 CEST 2010


Author: vincent
Date: Mon May 24 21:25:31 2010
New Revision: 2124

Log:
Fix r2105 when connection is closed with pending "forgotten" entries.

Modified:
    trunk/neo/dispatcher.py
    trunk/neo/tests/testDispatcher.py

Modified: trunk/neo/dispatcher.py
==============================================================================
--- trunk/neo/dispatcher.py [iso-8859-1] (original)
+++ trunk/neo/dispatcher.py [iso-8859-1] Mon May 24 21:25:31 2010
@@ -76,6 +76,8 @@
         notified_set = set()
         queue_dict = self.queue_dict
         for queue in message_table.itervalues():
+            if queue is NOBODY:
+                continue
             queue_id = id(queue)
             if queue_id not in notified_set:
                 queue.put((conn, None))

Modified: trunk/neo/tests/testDispatcher.py
==============================================================================
--- trunk/neo/tests/testDispatcher.py [iso-8859-1] (original)
+++ trunk/neo/tests/testDispatcher.py [iso-8859-1] Mon May 24 21:25:31 2010
@@ -123,6 +123,15 @@
         # ...but must not have reached the queue
         self.assertTrue(queue.empty())
 
+        # Register an expectation
+        self.dispatcher.register(conn, 1, queue)
+        # ...and forget about it
+        self.dispatcher.forget(conn, 1)
+        # No exception must happen if connection is lost.
+        self.dispatcher.unregister(conn)
+        # Forgotten message's queue must not have received a "None"
+        self.assertTrue(queue.empty())
+
 if __name__ == '__main__':
     unittest.main()
 





More information about the Neo-report mailing list