Commit 92f2ab72 authored by Vincent Pelletier's avatar Vincent Pelletier

When the disconnection is not caused by a broken node event, pick the state...

When the disconnection is not caused by a broken node event, pick the state from a mapping: by default, a disconnected node is considered down (ie, removed from node manager as soon as it gets disconnected), with the exception of a storage node (it must be kept in partition table, so it must also be kept in node manager).


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@1117 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 7990c1dc
......@@ -68,6 +68,10 @@ class MasterHandler(EventHandler):
packet.getId())
DISCONNECTED_STATE_DICT = {
protocol.STORAGE_NODE_TYPE: protocol.TEMPORARILY_DOWN_STATE,
}
class BaseServiceHandler(MasterHandler):
"""This class deals with events for a service phase."""
......@@ -79,6 +83,8 @@ class BaseServiceHandler(MasterHandler):
def handleConnectionLost(self, conn, new_state):
node = self.app.nm.getNodeByUUID(conn.getUUID())
assert node is not None
if new_state != protocol.BROKEN_STATE:
new_state = DISCONNECTED_STATE_DICT.get(node.getType(), protocol.DOWN_STATE)
if node.getState() == new_state:
return
if new_state != protocol.BROKEN_STATE and node.getState() == protocol.PENDING_STATE:
......
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