Commit 03b71f1e authored by Vincent Pelletier's avatar Vincent Pelletier

Only implement _dropId method in BaseServiceHandler class, as we have no...

Only implement _dropId method in BaseServiceHandler class, as we have no broadcast to do except when we are primary master.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@1072 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 1ec19260
......@@ -29,17 +29,9 @@ class MasterHandler(EventHandler):
pass
def _dropIt(self, conn, node, new_state):
if node is None or node.getState() == new_state:
return
if new_state != protocol.BROKEN_STATE and node.getState() == protocol.PENDING_STATE:
# was in pending state, so drop it from the node manager to forget
# it and do not set in running state when it comes back
logging.info('drop a pending node from the node manager')
self.app.nm.remove(node)
node.setState(new_state)
# clean node related data in specialized handlers
self.app.broadcastNodeInformation(node)
self._nodeLost(conn, node)
# This method provides a hook point overridable by service classes.
# It is triggered when a connection to a node gets lost.
pass
def connectionClosed(self, conn):
node = self.app.nm.getNodeByUUID(conn.getUUID())
......@@ -101,6 +93,19 @@ class MasterHandler(EventHandler):
class BaseServiceHandler(MasterHandler):
"""This class deals with events for a service phase."""
def _dropIt(self, conn, node, new_state):
if node is None or node.getState() == new_state:
return
if new_state != protocol.BROKEN_STATE and node.getState() == protocol.PENDING_STATE:
# was in pending state, so drop it from the node manager to forget
# it and do not set in running state when it comes back
logging.info('drop a pending node from the node manager')
self.app.nm.remove(node)
node.setState(new_state)
# clean node related data in specialized handlers
self.app.broadcastNodeInformation(node)
self._nodeLost(conn, node)
def handleAskLastIDs(self, conn, packet):
app = self.app
conn.answer(protocol.answerLastIDs(app.loid, app.ltid, app.pt.getID()), packet.getId())
......
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