Commit 2245bf19 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Rename handleConnectionLost to connectionLost for consistency. Add in the TODO

list to think about a global rename of handler's methods.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@1148 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 6b121f40
......@@ -68,7 +68,8 @@ RC - Review output of pylint (CODE)
types, group, consider using one class per paquet, extract patterns.
- Review handler split (CODE)
The current handler split is the result of small incremental changes. A
global review is required to make them square.
global review is required to make them square. Consider rename handler
methods without the 'handle' prefix.
Storage
- Implement incremental storage verification (BANDWITH)
......
......@@ -50,7 +50,7 @@ class BootstrapManager(EventHandler):
EventHandler.connectionFailed(self, conn)
self.current = None
def handleConnectionLost(self, conn, new_state):
def connectionLost(self, conn, new_state):
self.current = None
def handleNotReady(self, conn, packet, message):
......
......@@ -46,7 +46,7 @@ class BaseHandler(EventHandler):
self.dispatch(conn, packet)
def handleConnectionLost(self, conn, new_state):
def connectionLost(self, conn, new_state):
self.app.dispatcher.unregister(conn)
def connectionFailed(self, conn):
......
......@@ -31,7 +31,7 @@ class StorageEventHandler(BaseHandler):
app.cp.removeConnection(node)
app.dispatcher.unregister(conn)
def handleConnectionLost(self, conn, new_state):
def connectionLost(self, conn, new_state):
self._dealWithStorageFailure(conn)
def connectionFailed(self, conn):
......
......@@ -147,19 +147,19 @@ class EventHandler(object):
def timeoutExpired(self, conn):
"""Called when a timeout event occurs."""
logging.debug('timeout expired for %s:%d', *(conn.getAddress()))
self.handleConnectionLost(conn, protocol.TEMPORARILY_DOWN_STATE)
self.connectionLost(conn, protocol.TEMPORARILY_DOWN_STATE)
def connectionClosed(self, conn):
"""Called when a connection is closed by the peer."""
logging.debug('connection closed for %s:%d', *(conn.getAddress()))
self.handleConnectionLost(conn, protocol.TEMPORARILY_DOWN_STATE)
self.connectionLost(conn, protocol.TEMPORARILY_DOWN_STATE)
def peerBroken(self, conn):
"""Called when a peer is broken."""
logging.error('%s:%d is broken', *(conn.getAddress()))
self.handleConnectionLost(conn, protocol.BROKEN_STATE)
self.connectionLost(conn, protocol.BROKEN_STATE)
def handleConnectionLost(self, conn, new_state):
def connectionLost(self, conn, new_state):
""" this is a method to override in sub-handlers when there is no need
to make distinction from the kind event that closed the connection """
pass
......
......@@ -80,7 +80,7 @@ class BaseServiceHandler(MasterHandler):
# It is triggered when a connection to a node gets lost.
pass
def handleConnectionLost(self, conn, new_state):
def connectionLost(self, conn, new_state):
node = self.app.nm.getNodeByUUID(conn.getUUID())
assert node is not None
if new_state != protocol.BROKEN_STATE:
......
......@@ -26,7 +26,7 @@ from neo.util import dump
class AdministrationHandler(MasterHandler):
"""This class deals with messages from the admin node only"""
def handleConnectionLost(self, conn, new_state):
def connectionLost(self, conn, new_state):
node = self.app.nm.getNodeByUUID(conn.getUUID())
self.app.nm.remove(node)
......
......@@ -27,7 +27,7 @@ from neo.node import MasterNode
class SecondaryMasterHandler(MasterHandler):
""" Handler used by primary to handle secondary masters"""
def handleConnectionLost(self, conn, new_state):
def connectionLost(self, conn, new_state):
node = self.app.nm.getNodeByUUID(conn.getUUID())
assert node is not None
node.setState(DOWN_STATE)
......
......@@ -32,7 +32,7 @@ class BaseStorageHandler(EventHandler):
class BaseMasterHandler(BaseStorageHandler):
def handleConnectionLost(self, conn, new_state):
def connectionLost(self, conn, new_state):
raise PrimaryFailure('connection lost')
def handleReelectPrimaryMaster(self, conn, packet):
......
......@@ -25,7 +25,7 @@ from neo.node import ClientNode
class IdentificationHandler(BaseStorageHandler):
""" Handler used for incoming connections during operation state """
def handleConnectionLost(self, conn, new_state):
def connectionLost(self, conn, new_state):
logging.warning('A connection was lost during identification')
def handleRequestNodeIdentification(self, conn, packet, node_type,
......
......@@ -28,7 +28,7 @@ class ReplicationHandler(BaseStorageHandler):
# Nothing to do.
pass
def handleConnectionLost(self, conn, new_state):
def connectionLost(self, conn, new_state):
logging.error('replication is stopped due to a connection lost')
self.app.replicator.reset()
......
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