Commit 5dc59a4f authored by Aurel's avatar Aurel

client must close connection to other nodes if their state is hidden

or down


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@616 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent def04477
......@@ -23,7 +23,8 @@ from neo import protocol
from neo.protocol import Packet, \
MASTER_NODE_TYPE, STORAGE_NODE_TYPE, CLIENT_NODE_TYPE, \
INVALID_UUID, RUNNING_STATE, TEMPORARILY_DOWN_STATE, \
BROKEN_STATE, FEEDING_STATE, DISCARDED_STATE
BROKEN_STATE, FEEDING_STATE, DISCARDED_STATE, DOWN_STATE \
HIDDEN_STATE
from neo.node import MasterNode, StorageNode, ClientNode
from neo.pt import PartitionTable
from neo.client.exception import NEOStorageError
......@@ -67,6 +68,7 @@ class PrimaryHandler(BaseHandler):
app = self.app
nm = app.nm
for node_type, ip_address, port, uuid, state in node_list:
logging.info("notified of %s %s %d %s %s" %(node_type, ip_address, port, dump(uuid), state))
# Register new nodes.
addr = (ip_address, port)
# Try to retrieve it from nm
......@@ -104,6 +106,12 @@ class PrimaryHandler(BaseHandler):
continue
n.setState(state)
# close connection to this node if no longer running
if node_type in (MASTER_NODE_STATE, STORAGE_NODE_TYPE) and \
state in (DOWN_STATE, HIDDEN_STATE):
for conn self.app.em.getConnectionList():
if conn.getUUID() == n.getUUID():
conn.close()
class PrimaryBootstrapHandler(PrimaryHandler):
......
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