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:
# the node is still alive
if node.isBroken(): if node.isBroken():
raise BrokenNodeDisallowedError raise BrokenNodeDisallowedError
elif node.isRunning(): else:
# still running, reject this new node node = app.nm.getByAddress(address)
raise ProtocolError('invalid server address') if node:
if node.isConnected(): if node.isRunning():
# more than one connection from this node # cloned/evil/buggy node connecting to us
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