Commit aa21ed33 authored by Aurel's avatar Aurel

do not failed in peerBroken method if node does not exist


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@257 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 95eaa500
...@@ -73,10 +73,11 @@ class ElectionEventHandler(MasterEventHandler): ...@@ -73,10 +73,11 @@ class ElectionEventHandler(MasterEventHandler):
addr = conn.getAddress() addr = conn.getAddress()
node = app.nm.getNodeByServer(addr) node = app.nm.getNodeByServer(addr)
if isinstance(conn, ClientConnection): if isinstance(conn, ClientConnection):
node.setState(DOWN_STATE) if node is not None:
node.setState(DOWN_STATE)
app.negotiating_master_node_set.discard(addr) app.negotiating_master_node_set.discard(addr)
else: else:
if node.getUUID() is not None: if node is not None and node.getUUID() is not None:
node.setState(BROKEN_STATE) node.setState(BROKEN_STATE)
MasterEventHandler.peerBroken(self, conn) MasterEventHandler.peerBroken(self, conn)
...@@ -141,7 +142,7 @@ class ElectionEventHandler(MasterEventHandler): ...@@ -141,7 +142,7 @@ class ElectionEventHandler(MasterEventHandler):
# told me at the moment. # told me at the moment.
if n.getUUID() is None: if n.getUUID() is None:
n.setUUID(uuid) n.setUUID(uuid)
if primary_uuid != INVALID_UUID: if primary_uuid != INVALID_UUID:
# The primary master is defined. # The primary master is defined.
if app.primary_master_node is not None \ if app.primary_master_node is not None \
...@@ -237,7 +238,6 @@ class ElectionEventHandler(MasterEventHandler): ...@@ -237,7 +238,6 @@ class ElectionEventHandler(MasterEventHandler):
continue continue
info = n.getServer() + (n.getUUID() or INVALID_UUID,) info = n.getServer() + (n.getUUID() or INVALID_UUID,)
known_master_list.append(info) known_master_list.append(info)
p = Packet() p = Packet()
p.answerPrimaryMaster(packet.getId(), primary_uuid, known_master_list) p.answerPrimaryMaster(packet.getId(), primary_uuid, known_master_list)
conn.addPacket(p) conn.addPacket(p)
......
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