Commit 02a1df15 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Handler connectionFailed not like connectionLost.

Event connectionFailed is trigerred only when a connection do not succeed,
meaning that the connection was never opened and no packets could have
been sent or received through it. Here the unregistration from the
dispatcher was useless in case of a connection failed.
Remove the related XXX.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1736 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent ce17b91c
......@@ -22,25 +22,17 @@ from neo.protocol import NodeTypes, ProtocolError
class StorageEventHandler(BaseHandler):
def _dealWithStorageFailure(self, conn):
app = self.app
node = app.nm.getByAddress(conn.getAddress())
assert node is not None
# Remove from pool connection
app.cp.removeConnection(node)
app.dispatcher.unregister(conn)
def connectionLost(self, conn, new_state):
self._dealWithStorageFailure(conn)
node = self.app.nm.getByAddress(conn.getAddress())
assert node is not None
self.app.cp.removeConnection(node)
self.app.dispatcher.unregister(conn)
def connectionFailed(self, conn):
# XXX: a connection failure is not like a connection lost, we should not
# have to clear the dispatcher because the connection was never
# established and so, no packet should have been send and thus, nothing
# must be expected. This should be well done if the first packet sent is
# done after the connectionCompleted event or a packet received.
# Connection to a storage node failed
self._dealWithStorageFailure(conn)
node = self.app.nm.getByAddress(conn.getAddress())
assert node is not None
self.app.cp.removeConnection(node)
super(StorageEventHandler, self).connectionFailed(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