[Neo-report] r2559 vincent - in /trunk/neo: client/handlers/__init__.py dispatcher.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Dec 22 13:52:29 CET 2010
Author: vincent
Date: Wed Dec 22 13:52:29 2010
New Revision: 2559
Log:
Data pushed in queue is not opaque, as "forget" needs to know it.
The "data" parameter was meant to be used as an opaque type, but as
"forget" method needs to know its structure, stop pretending it's opaque.
This simplifies dispatch arguments a little bit.
Modified:
trunk/neo/client/handlers/__init__.py
trunk/neo/dispatcher.py
Modified: trunk/neo/client/handlers/__init__.py
==============================================================================
--- trunk/neo/client/handlers/__init__.py [iso-8859-1] (original)
+++ trunk/neo/client/handlers/__init__.py [iso-8859-1] Wed Dec 22 13:52:29 2010
@@ -38,7 +38,7 @@ class BaseHandler(EventHandler):
def packetReceived(self, conn, packet):
"""Redirect all received packet to dispatcher thread."""
if packet.isResponse():
- if not self.dispatcher.dispatch(conn, packet.getId(), (conn, packet)):
+ if not self.dispatcher.dispatch(conn, packet.getId(), packet):
raise ProtocolError('Unexpected response packet from %r: %r',
conn, packet)
else:
Modified: trunk/neo/dispatcher.py
==============================================================================
--- trunk/neo/dispatcher.py [iso-8859-1] (original)
+++ trunk/neo/dispatcher.py [iso-8859-1] Wed Dec 22 13:52:29 2010
@@ -54,15 +54,17 @@ class Dispatcher:
@giant_lock
@profiler_decorator
- def dispatch(self, conn, msg_id, data):
- """Retrieve register-time provided queue, and put data in it."""
+ def dispatch(self, conn, msg_id, packet):
+ """
+ Retrieve register-time provided queue, and put conn and packet in it.
+ """
queue = self.message_table.get(id(conn), EMPTY).pop(msg_id, None)
if queue is None:
return False
elif queue is NOBODY:
return True
self._decrefQueue(queue)
- queue.put(data)
+ queue.put((conn, packet))
return True
def _decrefQueue(self, queue):
More information about the Neo-report
mailing list