Commit 7764d956 authored by Vincent Pelletier's avatar Vincent Pelletier

Do not raise on disconnection if a response was received.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2390 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 41e7ee66
...@@ -53,11 +53,12 @@ class NeoCTL(object): ...@@ -53,11 +53,12 @@ class NeoCTL(object):
connection.ask(packet) connection.ask(packet)
response_queue = self.response_queue response_queue = self.response_queue
assert len(response_queue) == 0 assert len(response_queue) == 0
while len(response_queue) == 0: while self.connected:
# XXX: this burn the CPU self.em.poll(1)
self.em.poll(0) if response_queue:
if not self.connected: break
raise NotReadyException, 'Connection closed' else:
raise NotReadyException, 'Connection closed'
response = response_queue.pop() response = response_queue.pop()
if response[0] == Packets.Error and \ if response[0] == Packets.Error and \
response[1] == ErrorCodes.NOT_READY: response[1] == ErrorCodes.NOT_READY:
......
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