Commit ce98da46 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Update master node state during bootstrap.

Allow know the primary master as RUNNING state instead of UNKNOWN.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2086 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent dcfc6ee1
...@@ -52,6 +52,7 @@ class BootstrapManager(EventHandler): ...@@ -52,6 +52,7 @@ class BootstrapManager(EventHandler):
Now ask who's the primary. Now ask who's the primary.
""" """
EventHandler.connectionCompleted(self, conn) EventHandler.connectionCompleted(self, conn)
self.current.setRunning()
conn.ask(Packets.AskPrimary()) conn.ask(Packets.AskPrimary())
def connectionFailed(self, conn): def connectionFailed(self, conn):
...@@ -67,6 +68,7 @@ class BootstrapManager(EventHandler): ...@@ -67,6 +68,7 @@ class BootstrapManager(EventHandler):
Triggered when an established network connection is lost. Triggered when an established network connection is lost.
Restart bootstrap. Restart bootstrap.
""" """
self.current.setTemporarilyDown()
self.current = None self.current = None
def notReady(self, conn, message): def notReady(self, conn, message):
......
...@@ -45,13 +45,17 @@ class BootstrapManagerTests(NeoTestBase): ...@@ -45,13 +45,17 @@ class BootstrapManagerTests(NeoTestBase):
# Tests # Tests
def testConnectionCompleted(self): def testConnectionCompleted(self):
conn = self.getFakeConnection(address=("127.0.0.1", self.master_port)) address=("127.0.0.1", self.master_port)
conn = self.getFakeConnection(address=address)
self.bootstrap.current = self.app.nm.createMaster(address=address)
self.bootstrap.connectionCompleted(conn) self.bootstrap.connectionCompleted(conn)
self.checkAskPrimary(conn) self.checkAskPrimary(conn)
def testHandleNotReady(self): def testHandleNotReady(self):
# the primary is not ready # the primary is not ready
conn = self.getFakeConnection() address=("127.0.0.1", self.master_port)
conn = self.getFakeConnection(address=address)
self.bootstrap.current = self.app.nm.createMaster(address=address)
self.bootstrap.notReady(conn, '') self.bootstrap.notReady(conn, '')
self.checkClosed(conn) self.checkClosed(conn)
self.checkNoPacketSent(conn) self.checkNoPacketSent(conn)
......
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