Commit cb72a2c6 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Deal with client failures notified by a primary master node.

git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@75 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent bf56688c
......@@ -13,6 +13,9 @@ class StorageEventHandler(EventHandler):
self.app = app
EventHandler.__init__(self)
def dealWithClientFailure(self, uuid):
pass
def handleRequestNodeIdentification(self, conn, packet, node_type,
uuid, ip_address, port, name):
raise NotImplementedError('this method must be overridden')
......@@ -139,6 +142,7 @@ class StorageEventHandler(EventHandler):
n = ClientNode(uuid = uuid)
app.nm.add(n)
else:
self.dealWithClientFailure(uuid)
n = app.nm.getNodeByUUID(uuid)
if n is not None:
app.nm.remove(n)
......
......@@ -49,8 +49,7 @@ class OperationEventHandler(StorageEventHandler):
# I am a master node.
StorageEventHandler.connectionAccepted(self, conn, s, addr)
def dealWithClientFailure(self, conn):
uuid = conn.getUUID()
def dealWithClientFailure(self, uuid):
if uuid is not None:
app = self.app
node = app.nm.getNodeByUUID(uuid)
......@@ -79,7 +78,7 @@ class OperationEventHandler(StorageEventHandler):
# Otherwise, this connection is to another storage node.
raise NotImplemented
else:
self.dealWithClientFailure(conn)
self.dealWithClientFailure(conn.getUUID())
StorageEventHandler.timeoutExpired(self, conn)
......@@ -93,7 +92,7 @@ class OperationEventHandler(StorageEventHandler):
# Otherwise, this connection is to another storage node.
raise NotImplemented
else:
self.dealWithClientFailure(conn)
self.dealWithClientFailure(conn.getUUID())
StorageEventHandler.connectionClosed(self, conn)
......@@ -107,7 +106,7 @@ class OperationEventHandler(StorageEventHandler):
# Otherwise, this connection is to another storage node.
raise NotImplemented
else:
self.dealWithClientFailure(conn)
self.dealWithClientFailure(conn.getUUID())
StorageEventHandler.peerBroken(self, conn)
......
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