aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/controller.py
diff options
context:
space:
mode:
Diffstat (limited to 'libmproxy/controller.py')
-rw-r--r--libmproxy/controller.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/libmproxy/controller.py b/libmproxy/controller.py
index 4a72cf80..b754ac36 100644
--- a/libmproxy/controller.py
+++ b/libmproxy/controller.py
@@ -89,7 +89,7 @@ class Master:
self.masterq = Queue.Queue()
self.should_exit = threading.Event()
- def tick(self, q):
+ def tick(self, q, timeout):
changed = False
try:
# This endless loop runs until the 'Queue.Empty'
@@ -97,8 +97,7 @@ class Master:
# the queue, this speeds up every request by 0.1 seconds,
# because get_input(..) function is not blocking.
while True:
- # Small timeout to prevent pegging the CPU
- msg = q.get(timeout=0.01)
+ msg = q.get(timeout=timeout)
self.handle(*msg)
changed = True
except Queue.Empty:
@@ -109,7 +108,7 @@ class Master:
self.should_exit.clear()
self.server.start_slave(Slave, Channel(self.masterq, self.should_exit))
while not self.should_exit.is_set():
- self.tick(self.masterq)
+ self.tick(self.masterq, 0.01)
self.shutdown()
def handle(self, mtype, obj):