mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 00:01:36 +00:00
Misc cleanups
This commit is contained in:
parent
97b15b58b7
commit
f2e010ebc0
@ -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()
|
||||
|
@ -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
|
||||
|
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user