mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-22 15:37:45 +00:00
server replay: keep --kill active
This commit is contained in:
parent
4d16bb8cb6
commit
dcdee7dc46
@ -789,8 +789,6 @@ class FlowMaster(controller.Master):
|
||||
self.kill_nonreplay = kill
|
||||
|
||||
def stop_server_playback(self):
|
||||
if self.server_playback.exit:
|
||||
self.shutdown()
|
||||
self.server_playback = None
|
||||
|
||||
def do_server_playback(self, flow):
|
||||
@ -827,7 +825,8 @@ class FlowMaster(controller.Master):
|
||||
if self.server_playback:
|
||||
stop = (
|
||||
self.server_playback.count() == 0 and
|
||||
self.state.active_flow_count() == 0
|
||||
self.state.active_flow_count() == 0 and
|
||||
not self.kill_nonreplay
|
||||
)
|
||||
exit = self.server_playback.exit
|
||||
if stop:
|
||||
@ -935,7 +934,7 @@ class FlowMaster(controller.Master):
|
||||
if self.server_playback:
|
||||
pb = self.do_server_playback(f)
|
||||
if not pb and self.kill_nonreplay:
|
||||
f.kill(self)
|
||||
f.kill(self)
|
||||
|
||||
def process_new_response(self, f):
|
||||
if self.stickycookie_state:
|
||||
|
@ -68,8 +68,9 @@ class TestDumpMaster:
|
||||
m.handle_clientconnect(f.client_conn)
|
||||
m.handle_serverconnect(f.server_conn)
|
||||
m.handle_request(f)
|
||||
f.response = HTTPResponse.wrap(netlib.tutils.tresp(content=content))
|
||||
f = m.handle_response(f)
|
||||
if not f.error:
|
||||
f.response = HTTPResponse.wrap(netlib.tutils.tresp(content=content))
|
||||
f = m.handle_response(f)
|
||||
m.handle_clientdisconnect(f.client_conn)
|
||||
return f
|
||||
|
||||
|
@ -904,16 +904,6 @@ class TestFlowMaster:
|
||||
assert not fm.do_server_playback(r)
|
||||
assert fm.do_server_playback(tutils.tflow())
|
||||
|
||||
fm.start_server_playback(
|
||||
pb,
|
||||
False,
|
||||
[],
|
||||
True,
|
||||
False,
|
||||
None,
|
||||
False,
|
||||
None,
|
||||
False)
|
||||
q = queue.Queue()
|
||||
fm.tick(q, 0)
|
||||
assert fm.should_exit.is_set()
|
||||
|
Loading…
Reference in New Issue
Block a user