Commit ad52292a authored by Grégory Wisniewski's avatar Grégory Wisniewski

Define trying_admin_node in __init__ and simplify loop condition.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@984 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 5308866e
...@@ -171,14 +171,15 @@ class Application(object): ...@@ -171,14 +171,15 @@ class Application(object):
self.server = (ip, port) self.server = (ip, port)
self.em = EventManager() self.em = EventManager()
self.ptid = None self.ptid = None
self.trying_admin_node = False
def getConnection(self): def getConnection(self):
if self.conn is None: if self.conn is None:
handler = CommandEventHandler(self) handler = CommandEventHandler(self)
# connect to admin node # connect to admin node
self.trying_admin_node = False self.trying_admin_node = True
conn = None conn = None
while 1: while self.trying_admin_node:
self.em.poll(1) self.em.poll(1)
if conn is None: if conn is None:
self.trying_admin_node = True self.trying_admin_node = True
...@@ -186,8 +187,6 @@ class Application(object): ...@@ -186,8 +187,6 @@ class Application(object):
conn = ClientConnection(self.em, handler, \ conn = ClientConnection(self.em, handler, \
addr = self.server, addr = self.server,
connector_handler = self.connector_handler) connector_handler = self.connector_handler)
if self.trying_admin_node is False:
break
self.conn = conn self.conn = conn
return self.conn return self.conn
......
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