diff --git a/mitmproxy/builtins/clientplayback.py b/mitmproxy/builtins/clientplayback.py index 0cc10110e..c40d19043 100644 --- a/mitmproxy/builtins/clientplayback.py +++ b/mitmproxy/builtins/clientplayback.py @@ -6,6 +6,7 @@ class ClientPlayback: self.flows = None self.current = None self.keepserving = None + self.has_replayed = False def count(self): if self.flows: @@ -32,5 +33,7 @@ class ClientPlayback: self.current = None if self.flows and not self.current: self.current = ctx.master.replay_request(self.flows.pop(0)) - if not self.flows and not self.current and not self.keepserving: - ctx.master.shutdown() + self.has_replayed = True + if self.has_replayed: + if not self.flows and not self.current and not self.keepserving: + ctx.master.shutdown() diff --git a/mitmproxy/builtins/dumper.py b/mitmproxy/builtins/dumper.py index 743ca72eb..60d00518f 100644 --- a/mitmproxy/builtins/dumper.py +++ b/mitmproxy/builtins/dumper.py @@ -232,6 +232,14 @@ class Dumper(object): if self.match(f): self.echo_flow(f) + def tcp_error(self, f): + self.echo( + "Error in TCP connection to {}: {}".format( + repr(f.server_conn.address), f.error + ), + fg="red" + ) + def tcp_message(self, f): if not self.match(f): return diff --git a/mitmproxy/flow/master.py b/mitmproxy/flow/master.py index 81882fcde..94b46f3f3 100644 --- a/mitmproxy/flow/master.py +++ b/mitmproxy/flow/master.py @@ -57,11 +57,7 @@ class FlowMaster(controller.Master): self.apps = modules.AppRegistry() def start_app(self, host, port): - self.apps.add( - app.mapp, - host, - port - ) + self.apps.add(app.mapp, host, port) def set_stream_large_bodies(self, max_size): if max_size is not None: @@ -69,9 +65,6 @@ class FlowMaster(controller.Master): else: self.stream_large_bodies = False - def tick(self, timeout): - return super(FlowMaster, self).tick(timeout) - def duplicate_flow(self, f): """ Duplicate flow, and insert it into state without triggering any of @@ -267,10 +260,7 @@ class FlowMaster(controller.Master): @controller.handler def tcp_error(self, flow): - self.add_log("Error in TCP connection to {}: {}".format( - repr(flow.server_conn.address), - flow.error - ), "info") + pass @controller.handler def tcp_close(self, flow):