Commit e18a6d2a authored by Vincent Pelletier's avatar Vincent Pelletier

Test if there are pending message when looping.

This prevents from having an endless wait on "get" if the last connection
from which we were expecting answers got interrupted.
Note that this method will not raise any error related to this.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2028 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 2b1a9219
...@@ -212,9 +212,11 @@ class Application(object): ...@@ -212,9 +212,11 @@ class Application(object):
If True (default), will block until at least one packet was If True (default), will block until at least one packet was
received. received.
""" """
get = self.local_var.queue.get pending = self.dispatcher.pending
queue = self.local_var.queue
get = queue.get
_handlePacket = self._handlePacket _handlePacket = self._handlePacket
while True: while pending(queue):
try: try:
conn, packet = get(block) conn, packet = get(block)
except Empty: except Empty:
......
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