Commit 09c05b4d authored by Grégory Wisniewski's avatar Grégory Wisniewski

Add assertions to avoid bad node state transitions.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1545 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 6b10848f
...@@ -80,6 +80,7 @@ class ClientElectionHandler(ElectionHandler): ...@@ -80,6 +80,7 @@ class ClientElectionHandler(ElectionHandler):
def connectionFailed(self, conn): def connectionFailed(self, conn):
addr = conn.getAddress() addr = conn.getAddress()
node = self.app.nm.getByAddress(addr) node = self.app.nm.getByAddress(addr)
assert node.isUnknown(), node.getState()
# connection never success, node is still in unknown state # connection never success, node is still in unknown state
self.app.negotiating_master_node_set.discard(addr) self.app.negotiating_master_node_set.discard(addr)
self.app.unconnected_master_node_set.add(addr) self.app.unconnected_master_node_set.add(addr)
...@@ -96,6 +97,7 @@ class ClientElectionHandler(ElectionHandler): ...@@ -96,6 +97,7 @@ class ClientElectionHandler(ElectionHandler):
def _connectionLost(self, conn): def _connectionLost(self, conn):
addr = conn.getAddress() addr = conn.getAddress()
node = self.app.nm.getByAddress(addr) node = self.app.nm.getByAddress(addr)
assert not node.isUnknown(), node.getState()
node.setTemporarilyDown() node.setTemporarilyDown()
self.app.negotiating_master_node_set.discard(addr) self.app.negotiating_master_node_set.discard(addr)
MasterHandler.connectionClosed(self, conn) MasterHandler.connectionClosed(self, 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