Commit cd5ab5ad authored by Vincent Pelletier's avatar Vincent Pelletier

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

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2124 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 6d2da919
...@@ -76,6 +76,8 @@ class Dispatcher: ...@@ -76,6 +76,8 @@ class Dispatcher:
notified_set = set() notified_set = set()
queue_dict = self.queue_dict queue_dict = self.queue_dict
for queue in message_table.itervalues(): for queue in message_table.itervalues():
if queue is NOBODY:
continue
queue_id = id(queue) queue_id = id(queue)
if queue_id not in notified_set: if queue_id not in notified_set:
queue.put((conn, None)) queue.put((conn, None))
......
...@@ -123,6 +123,15 @@ class DispatcherTests(unittest.TestCase): ...@@ -123,6 +123,15 @@ class DispatcherTests(unittest.TestCase):
# ...but must not have reached the queue # ...but must not have reached the queue
self.assertTrue(queue.empty()) 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__': if __name__ == '__main__':
unittest.main() unittest.main()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment