Commit b05a5569 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Process connection lost event with the last handler.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2113 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent eefb4520
......@@ -100,6 +100,10 @@ class HandlerSwitcher(object):
def getHandler(self):
return self._pending[0][1]
def getLastHandler(self):
""" Return the last (may be unapplied) handler registered """
return self._pending[-1][1]
@profiler_decorator
def emit(self, request, timeout, on_timeout):
# register the request in the current handler
......@@ -507,7 +511,11 @@ class Connection(BaseConnection):
def _closure(self, was_connected=True):
assert self.connector is not None, self.whoSetConnector()
handler = self.getHandler()
# process the network events with the last registered handler to
# solve issues where a node is lost with pending handlers and
# create unexpected side effects.
# XXX: This solution is being tested and should be approved or reverted
handler = self._handlers.getLastHandler()
self.close()
if was_connected:
handler.connectionClosed(self)
......
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