Commit 8fc436a8 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Bug fix: Avoid open two connections to the same node.

After the AnswerPrimary was received, the unconnected_master_node_set was filled with the primary address, causing a new connection at the next iteration in the _doElection method.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1540 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 761860a2
......@@ -198,14 +198,17 @@ class Application(object):
# Try to connect to master nodes.
for addr in list(self.unconnected_master_node_set):
ClientConnection(self.em, client_handler, addr=addr,
connector_handler=self.connector_handler)
current_connections = [x.getAddress() for x in
self.em.getClientList()]
if addr not in current_connections:
ClientConnection(self.em, client_handler, addr=addr,
connector_handler=self.connector_handler)
self.em.poll(1)
if len(self.unconnected_master_node_set |
self.negotiating_master_node_set) == 0:
break
def _announcePrimary(self):
"""
Broadcast the announce that I'm the primary
......
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