[Neo-report] r2113 gregory - /trunk/neo/connection.py

nobody at svn.erp5.org nobody at svn.erp5.org
Sat May 15 09:54:41 CEST 2010


Author: gregory
Date: Sat May 15 09:54:41 2010
New Revision: 2113

Log:
Process connection lost event with the last handler.

Modified:
    trunk/neo/connection.py

Modified: trunk/neo/connection.py
==============================================================================
--- trunk/neo/connection.py [iso-8859-1] (original)
+++ trunk/neo/connection.py [iso-8859-1] Sat May 15 09:54:41 2010
@@ -99,6 +99,10 @@
 
     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):
@@ -507,7 +511,11 @@
 
     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)





More information about the Neo-report mailing list