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