diff --git a/libmproxy/console.py b/libmproxy/console.py index 4c4c9b5e9..0aab9ad07 100644 --- a/libmproxy/console.py +++ b/libmproxy/console.py @@ -1306,14 +1306,18 @@ class ConsoleMaster(flow.FlowMaster): return size def loop(self): + changed = True try: while not controller.exit: startloop = time.time() - self.statusbar.redraw() - size = self.drawscreen() - self.tick(self.masterq) + if changed: + self.statusbar.redraw() + size = self.drawscreen() + changed = self.tick(self.masterq) self.ui.set_input_timeouts(max_wait=0.1) keys = self.ui.get_input() + if keys: + changed = True for k in keys: if self.prompting: if k == "esc": diff --git a/libmproxy/controller.py b/libmproxy/controller.py index 337f379dc..6fed201ff 100644 --- a/libmproxy/controller.py +++ b/libmproxy/controller.py @@ -65,6 +65,7 @@ class Master: self.masterq = Queue.Queue() def tick(self, q): + changed = False try: # This endless loop runs until the 'Queue.Empty' # exception is thrown. If more than one request is in @@ -74,8 +75,10 @@ class Master: # Small timeout to prevent pegging the CPU msg = q.get(timeout=0.01) self.handle(msg) + changed = True except Queue.Empty: pass + return changed def run(self): if self.server: diff --git a/libmproxy/flow.py b/libmproxy/flow.py index 087999c35..be77af337 100644 --- a/libmproxy/flow.py +++ b/libmproxy/flow.py @@ -540,7 +540,7 @@ class FlowMaster(controller.Master): if self.server_playback.exit and self.server_playback.count() == 0: self.shutdown() - controller.Master.tick(self, q) + return controller.Master.tick(self, q) def load_flows(self, fr): """