Commit d51bf457 authored by Vincent Pelletier's avatar Vincent Pelletier

The existing code was exiting election loop too early, as there might not have...

The existing code was exiting election loop too early, as there might not have been an identified connection to primary master (ask/answerPrimaryMaster is quicker than ask/answerPrimaryMaster + request/acceptNodeIdentification).
The correct way is to stop waiting for connections to nodes other than primary master, and this can be done in answerPrimaryMaster.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@1197 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 9dc64e5e
...@@ -190,9 +190,8 @@ class Application(object): ...@@ -190,9 +190,8 @@ class Application(object):
ClientConnection(em, client_handler, addr = addr, ClientConnection(em, client_handler, addr = addr,
connector_handler = self.connector_handler) connector_handler = self.connector_handler)
em.poll(1) em.poll(1)
if (len(self.unconnected_master_node_set) == 0 \ if len(self.unconnected_master_node_set) == 0 \
and len(self.negotiating_master_node_set) == 0) \ and len(self.negotiating_master_node_set) == 0:
or self.primary is not None:
break break
# Now there are three situations: # Now there are three situations:
......
...@@ -192,6 +192,13 @@ class ClientElectionHandler(ElectionHandler): ...@@ -192,6 +192,13 @@ class ClientElectionHandler(ElectionHandler):
# Whatever the situation is, I trust this master. # Whatever the situation is, I trust this master.
app.primary = False app.primary = False
app.primary_master_node = primary_node app.primary_master_node = primary_node
# Stop waiting for connections than primary master's to
# complete to exit election phase ASAP.
primary_server = primary_node.getServer()
app.unconnected_master_node_set.intersection_update(
[primary_server])
app.negotiating_master_node_set.intersection_update(
[primary_server])
# Request a node idenfitication. # Request a node idenfitication.
conn.ask(protocol.requestNodeIdentification(MASTER_NODE_TYPE, conn.ask(protocol.requestNodeIdentification(MASTER_NODE_TYPE,
......
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