Commit 0961f1bd authored by Vincent Pelletier's avatar Vincent Pelletier

Do not use a busy loop.

Also, improve exit condition readability.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2391 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 7764d956
...@@ -40,10 +40,11 @@ class NeoCTL(object): ...@@ -40,10 +40,11 @@ class NeoCTL(object):
if not self.connected: if not self.connected:
self.connection = ClientConnection(self.em, self.handler, self.connection = ClientConnection(self.em, self.handler,
addr=self.server, connector=self.connector_handler()) addr=self.server, connector=self.connector_handler())
while not self.connected and self.connection is not None: while self.connection is not None:
# XXX: this burn the CPU if self.connected:
self.em.poll(0) break
if self.connection is None: self.em.poll(1)
else:
raise NotReadyException('not connected') raise NotReadyException('not connected')
return self.connection return self.connection
......
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