Commit 7c42eaeb authored by Grégory Wisniewski's avatar Grégory Wisniewski

The neoctl API try to connect only one time to the admin node, if the connection

fails, then it returns immediately.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@1152 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 632c4ef6
......@@ -37,17 +37,18 @@ class NeoCTL(object):
self.response_queue = []
def __getConnection(self):
while not self.connected:
self.connection = ClientConnection(
self.em, self.handler, addr=self.server,
connector_handler=self.connector_handler)
while not self.connected and self.connection is not None:
self.em.poll(0)
self.connection = ClientConnection(
self.em, self.handler, addr=self.server,
connector_handler=self.connector_handler)
while not self.connected and self.connection is not None:
self.em.poll(0)
return self.connection
def __ask(self, packet):
# TODO: make thread-safe
connection = self.__getConnection()
if connection is None:
raise NotReadyException("Can't connect to admin node")
connection.ask(packet)
response_queue = self.response_queue
assert len(response_queue) == 0
......
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