Commit 40b3f70e authored by Julien Muchembled's avatar Julien Muchembled

master: review conditions to check uuid/address conflicts when identifying nodes

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2677 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent d792ca6b
...@@ -31,21 +31,20 @@ class IdentificationHandler(MasterHandler): ...@@ -31,21 +31,20 @@ class IdentificationHandler(MasterHandler):
self.checkClusterName(name) self.checkClusterName(name)
app = self.app app = self.app
node_by_uuid = app.nm.getByUUID(uuid)
# handle conflicts and broken nodes # handle conflicts and broken nodes
node = node_by_uuid or app.nm.getByAddress(address) node = app.nm.getByUUID(uuid)
if node: if node:
if node_by_uuid and node.getAddress() == address: if node.isBroken():
# the node is still alive raise BrokenNodeDisallowedError
if node.isBroken(): else:
raise BrokenNodeDisallowedError node = app.nm.getByAddress(address)
elif node.isRunning(): if node:
# still running, reject this new node if node.isRunning():
raise ProtocolError('invalid server address') # cloned/evil/buggy node connecting to us
if node.isConnected():
# more than one connection from this node
raise ProtocolError('already connected') raise ProtocolError('already connected')
else:
assert not node.isConnected()
node.setAddress(address) node.setAddress(address)
node.setRunning() node.setRunning()
......
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