Commit cee4ef2a authored by Vincent Pelletier's avatar Vincent Pelletier

PrimaryMasterHandler must not be applied to the listening connection, but only...

PrimaryMasterHandler must not be applied to the listening connection, but only to the one remaining client connection (ie, the connection we established to the primary master node).
All other connections (listening & server) must get IdentificationHandler (actualy only using handleAskPrimaryMaster, so a more restricted handler would better fit).


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@1171 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 0c97b789
...@@ -639,12 +639,21 @@ class Application(object): ...@@ -639,12 +639,21 @@ class Application(object):
logging.info('play the secondary role with %s (%s:%d)', logging.info('play the secondary role with %s (%s:%d)',
dump(self.uuid), *(self.server)) dump(self.uuid), *(self.server))
handler = secondary.PrimaryMasterHandler(self)
primary_master_handler = secondary.PrimaryMasterHandler(self)
handler = identification.IdentificationHandler(self)
em = self.em em = self.em
# Make sure that every connection has the secondary event handler. # Make sure that every connection has the secondary event handler.
connection_list = em.getConnectionList()
primary_master_found = False
for conn in em.getConnectionList(): for conn in em.getConnectionList():
conn.setHandler(handler) if (not conn.isListening()) and conn.isClient():
assert not primary_master_found
primary_master_found = True
conn.setHandler(primary_master_handler)
else:
conn.setHandler(handler)
while 1: while 1:
em.poll(1) em.poll(1)
......
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