Commit ce44e838 authored by Vincent Pelletier's avatar Vincent Pelletier

Make Dispatcher.pop expect a msg_id instead of a message.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@1022 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 51ca7c9e
...@@ -38,7 +38,7 @@ class BaseHandler(EventHandler): ...@@ -38,7 +38,7 @@ class BaseHandler(EventHandler):
def packetReceived(self, conn, packet): def packetReceived(self, conn, packet):
"""Redirect all received packet to dispatcher thread.""" """Redirect all received packet to dispatcher thread."""
if packet.isResponse(): if packet.isResponse():
queue = self.dispatcher.pop(conn, packet, None) queue = self.dispatcher.pop(conn, packet.getId(), None)
if queue is None: if queue is None:
raise UnexpectedPacketError('Unexpected response packet') raise UnexpectedPacketError('Unexpected response packet')
queue.put((conn, packet)) queue.put((conn, packet))
......
...@@ -23,9 +23,9 @@ class Dispatcher: ...@@ -23,9 +23,9 @@ class Dispatcher:
def __init__(self): def __init__(self):
self.message_table = {} self.message_table = {}
def pop(self, conn, packet, default=MARKER): def pop(self, conn, msg_id, default=MARKER):
"""Retrieve register-time provided payload.""" """Retrieve register-time provided payload."""
key = (id(conn), packet.getId()) key = (id(conn), msg_id)
if default is MARKER: if default is MARKER:
result = self.message_table.pop(key) result = self.message_table.pop(key)
else: else:
......
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