Commit 7a736ff7 authored by Grégory Wisniewski's avatar Grégory Wisniewski

The primary master refuse more than one connection from a node.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1992 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent cae1f178
...@@ -38,21 +38,22 @@ class IdentificationHandler(MasterHandler): ...@@ -38,21 +38,22 @@ class IdentificationHandler(MasterHandler):
node = node_by_uuid or node_by_addr node = node_by_uuid or node_by_addr
if node_by_uuid is not None: if node_by_uuid is not None:
if node.getAddress() == address: if node.getAddress() == address:
# the node is still alive
if node.isBroken(): if node.isBroken():
raise protocol.BrokenNodeDisallowedError raise protocol.BrokenNodeDisallowedError
# the node is still alive
node.setRunning()
if node.getAddress() != address: if node.getAddress() != address:
# this node has changed its address
if node.isRunning(): if node.isRunning():
# still running, reject this new node # still running, reject this new node
raise protocol.ProtocolError('invalid server address') raise protocol.ProtocolError('invalid server address')
# this node has changed its address
node.setAddress(address)
node.setRunning()
if node_by_uuid is None and node_by_addr is not None: if node_by_uuid is None and node_by_addr is not None:
if node.isRunning(): if node.isRunning():
# still running, reject this new node # still running, reject this new node
raise protocol.ProtocolError('invalid server address') raise protocol.ProtocolError('invalid server address')
if node is not None:
if node.isConnected():
# more than one connection from this node
raise protocol.ProtocolError('already connected')
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