Commit 6b0d9e6e authored by Grégory Wisniewski's avatar Grégory Wisniewski

Apply the connection on the node after identification.

Remove the binding at connection closure.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1817 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent dfa4e9e5
......@@ -245,6 +245,10 @@ class Connection(BaseConnection):
BaseConnection.close(self)
for event in self.event_dict.itervalues():
self.em.removeIdleEvent(event)
from neo.node import NodeManager
node = NodeManager.getByUUID(self.getUUID())
if node is not None:
node.setConnection(None)
self.event_dict.clear()
self.write_buf = ""
self.read_buf = ""
......
......@@ -69,6 +69,7 @@ class IdentificationHandler(MasterHandler):
# set up the node
node.setUUID(uuid)
node.setState(state)
node.setConnection(conn)
# set up the connection
conn.setUUID(uuid)
conn.setHandler(handler)
......
......@@ -36,6 +36,8 @@ class StorageServiceHandler(BaseServiceHandler):
def nodeLost(self, conn, node):
logging.info('storage node lost')
assert not node.isRunning(), node.getState()
node.setConnection(None)
if not self.app.pt.operational():
raise OperationFailure, 'cannot continue operation'
# this is intentionaly placed after the raise because the last cell in a
......
......@@ -106,6 +106,7 @@ class RecoveryManager(MasterHandler):
assert node is not None
if node.getState() == new_state:
return
node.setConnection(None)
node.setState(new_state)
def connectionCompleted(self, conn):
......
......@@ -260,6 +260,7 @@ class VerificationManager(BaseServiceHandler):
pass
def nodeLost(self, conn, node):
node.setConnection(None)
if not self.app.pt.operational():
raise VerificationFailure, 'cannot continue verification'
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