Commit 3acd52fa authored by Grégory Wisniewski's avatar Grégory Wisniewski

Send a notification to any identified node about the cluster state, and cut

any client connections when keaving the RUNNING state.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@726 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 6da1b463
...@@ -731,19 +731,20 @@ class Application(object): ...@@ -731,19 +731,20 @@ class Application(object):
RuntimeError('Unexpected node type') RuntimeError('Unexpected node type')
# change handlers # change handlers
notification_packet = protocol.notifyClusterInformation(state)
for conn in em.getConnectionList(): for conn in em.getConnectionList():
node = nm.getNodeByUUID(conn.getUUID()) node = nm.getNodeByUUID(conn.getUUID())
if conn.isListeningConnection() or node is None: if conn.isListeningConnection() or node is None:
# not identified or listening, keep the identification handler # not identified or listening, keep the identification handler
continue continue
node_type = node.getNodeType() node_type = node.getNodeType()
conn.notify(notification_packet)
if node_type in (ADMIN_NODE_TYPE, MASTER_NODE_TYPE): if node_type in (ADMIN_NODE_TYPE, MASTER_NODE_TYPE):
# those node types keep their own handler # those node types keep their own handler
continue continue
if node_type == CLIENT_NODE_TYPE: if node_type == CLIENT_NODE_TYPE:
if state != RUNNING: if state != protocol.RUNNING:
# FIXME: cut the connection ? conn.close()
pass
handler = ClientServiceEventHandler handler = ClientServiceEventHandler
elif node_type == STORAGE_NODE_TYPE: elif node_type == STORAGE_NODE_TYPE:
handler = storage_handler handler = storage_handler
......
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