From 7800b7c9103ae119a13b81048a84f626850cf04f Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sat, 23 Feb 2013 14:08:28 +1300 Subject: Refactor proxy core communications to be clearer. --- libmproxy/controller.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'libmproxy/controller.py') diff --git a/libmproxy/controller.py b/libmproxy/controller.py index c36bb9df..849d998b 100644 --- a/libmproxy/controller.py +++ b/libmproxy/controller.py @@ -56,13 +56,14 @@ class Channel: def ask(self, m): """ - Send a message to the master, and wait for a response. + Decorate a message with a reply attribute, and send it to the + master. then wait for a response. """ m.reply = Reply(m) self.q.put(m) while not should_exit: try: - # The timeout is here so we can handle a should_exit event. + # The timeout is here so we can handle a should_exit event. g = m.reply.q.get(timeout=0.5) except Queue.Empty: continue @@ -70,9 +71,10 @@ class Channel: def tell(self, m): """ - Send a message to the master, and keep going. + Decorate a message with a dummy reply attribute, send it to the + master, then return immediately. """ - m.reply = None + m.reply = DummyReply() self.q.put(m) -- cgit v1.2.3