aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/controller.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2013-02-23 14:08:28 +1300
committerAldo Cortesi <aldo@nullcube.com>2013-02-23 14:10:27 +1300
commit7800b7c9103ae119a13b81048a84f626850cf04f (patch)
tree452a887cb0ccadfecba503effd697c24dd1606c3 /libmproxy/controller.py
parentaaf892e3afc682b2dc2a166a96872420e50092cd (diff)
downloadmitmproxy-7800b7c9103ae119a13b81048a84f626850cf04f.tar.gz
mitmproxy-7800b7c9103ae119a13b81048a84f626850cf04f.tar.bz2
mitmproxy-7800b7c9103ae119a13b81048a84f626850cf04f.zip
Refactor proxy core communications to be clearer.
Diffstat (limited to 'libmproxy/controller.py')
-rw-r--r--libmproxy/controller.py10
1 files changed, 6 insertions, 4 deletions
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)