Commit 506d7017 authored by Aurel's avatar Aurel

fix handleNotifyNodeInformation


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@86 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 97c6be1c
...@@ -241,7 +241,8 @@ class ClientEventHandler(EventHandler): ...@@ -241,7 +241,8 @@ class ClientEventHandler(EventHandler):
return return
app = self.app app = self.app
node = app.nm.getNodeByUUID(uuid) nm = app.nm
node = nm.getNodeByUUID(uuid)
# This must be sent only by primary master node # This must be sent only by primary master node
if not isinstance(node, MasterNode) \ if not isinstance(node, MasterNode) \
or app.primary_master_node is None \ or app.primary_master_node is None \
...@@ -251,10 +252,11 @@ class ClientEventHandler(EventHandler): ...@@ -251,10 +252,11 @@ class ClientEventHandler(EventHandler):
for node_type, ip_address, port, uuid, state in node_list: for node_type, ip_address, port, uuid, state in node_list:
# Register new nodes. # Register new nodes.
addr = (ip_address, port) addr = (ip_address, port)
n = app.nm.getNodeByServer(addr) n = nm.getNodeByServer(addr)
if n is None: if n is None:
if node_type == MASTER_NODE_TYPE: if node_type == MASTER_NODE_TYPE:
n = MasterNode(server = addr) n = MasterNode(server = addr)
nm.add(n)
if uuid != INVALID_UUID: if uuid != INVALID_UUID:
# If I don't know the UUID yet, believe what the peer # If I don't know the UUID yet, believe what the peer
# told me at the moment. # told me at the moment.
...@@ -264,15 +266,16 @@ class ClientEventHandler(EventHandler): ...@@ -264,15 +266,16 @@ class ClientEventHandler(EventHandler):
if uuid == INVALID_UUID: if uuid == INVALID_UUID:
# No interest. # No interest.
continue continue
n = StorageNode(server = addr) n = StorageNode(server = addr, uuid = uuid)
nm.add(n)
elif node_type == CLIENT_NODE_TYPE: elif node_type == CLIENT_NODE_TYPE:
if uuid == INVALID_UUID: if uuid == INVALID_UUID:
# No interest. # No interest.
continue continue
n = ClientNode(server = addr) n = ClientNode(server = addr, uuid = uuid)
nm.add(n)
else: else:
continue continue
app.nm.add(n)
n.setState(state) n.setState(state)
else: else:
......
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