Commit 116a1f3f authored by Grégory Wisniewski's avatar Grégory Wisniewski

The connectionCompleted event is only triggered in bootstrap handler, which will

then ask the primary master.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@843 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent e966eee6
...@@ -134,16 +134,6 @@ class MasterBaseEventHandler(EventHandler): ...@@ -134,16 +134,6 @@ class MasterBaseEventHandler(EventHandler):
"""Called when a connection is accepted.""" """Called when a connection is accepted."""
raise UnexpectedPacketError raise UnexpectedPacketError
def connectionCompleted(self, conn):
app = self.app
if app.trying_master_node is None:
# Should not happen.
raise RuntimeError('connection completed while not trying to connect')
# Ask a primary master.
conn.ask(protocol.askPrimaryMaster())
EventHandler.connectionCompleted(self, conn)
def _connectionLost(self, conn): def _connectionLost(self, conn):
app = self.app app = self.app
if app.primary_master_node and conn.getUUID() == app.primary_master_node.getUUID(): if app.primary_master_node and conn.getUUID() == app.primary_master_node.getUUID():
...@@ -275,6 +265,16 @@ class MasterRequestEventHandler(MasterBaseEventHandler): ...@@ -275,6 +265,16 @@ class MasterRequestEventHandler(MasterBaseEventHandler):
class MasterBootstrapEventHandler(MasterBaseEventHandler): class MasterBootstrapEventHandler(MasterBaseEventHandler):
"""This class manage the bootstrap part to the primary master node""" """This class manage the bootstrap part to the primary master node"""
def connectionCompleted(self, conn):
app = self.app
if app.trying_master_node is None:
# Should not happen.
raise RuntimeError('connection completed while not trying to connect')
# Ask a primary master.
conn.ask(protocol.askPrimaryMaster())
EventHandler.connectionCompleted(self, conn)
def handleNotReady(self, conn, packet, message): def handleNotReady(self, conn, packet, message):
app = self.app app = self.app
if app.trying_master_node is not None: if app.trying_master_node is not None:
......
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