mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 00:01:36 +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
|
self.kill_nonreplay = kill
|
||||||
|
|
||||||
def stop_server_playback(self):
|
def stop_server_playback(self):
|
||||||
if self.server_playback.exit:
|
|
||||||
self.shutdown()
|
|
||||||
self.server_playback = None
|
self.server_playback = None
|
||||||
|
|
||||||
def do_server_playback(self, flow):
|
def do_server_playback(self, flow):
|
||||||
@ -827,7 +825,8 @@ class FlowMaster(controller.Master):
|
|||||||
if self.server_playback:
|
if self.server_playback:
|
||||||
stop = (
|
stop = (
|
||||||
self.server_playback.count() == 0 and
|
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
|
exit = self.server_playback.exit
|
||||||
if stop:
|
if stop:
|
||||||
@ -935,7 +934,7 @@ class FlowMaster(controller.Master):
|
|||||||
if self.server_playback:
|
if self.server_playback:
|
||||||
pb = self.do_server_playback(f)
|
pb = self.do_server_playback(f)
|
||||||
if not pb and self.kill_nonreplay:
|
if not pb and self.kill_nonreplay:
|
||||||
f.kill(self)
|
f.kill(self)
|
||||||
|
|
||||||
def process_new_response(self, f):
|
def process_new_response(self, f):
|
||||||
if self.stickycookie_state:
|
if self.stickycookie_state:
|
||||||
|
@ -68,8 +68,9 @@ class TestDumpMaster:
|
|||||||
m.handle_clientconnect(f.client_conn)
|
m.handle_clientconnect(f.client_conn)
|
||||||
m.handle_serverconnect(f.server_conn)
|
m.handle_serverconnect(f.server_conn)
|
||||||
m.handle_request(f)
|
m.handle_request(f)
|
||||||
f.response = HTTPResponse.wrap(netlib.tutils.tresp(content=content))
|
if not f.error:
|
||||||
f = m.handle_response(f)
|
f.response = HTTPResponse.wrap(netlib.tutils.tresp(content=content))
|
||||||
|
f = m.handle_response(f)
|
||||||
m.handle_clientdisconnect(f.client_conn)
|
m.handle_clientdisconnect(f.client_conn)
|
||||||
return f
|
return f
|
||||||
|
|
||||||
|
@ -904,16 +904,6 @@ class TestFlowMaster:
|
|||||||
assert not fm.do_server_playback(r)
|
assert not fm.do_server_playback(r)
|
||||||
assert fm.do_server_playback(tutils.tflow())
|
assert fm.do_server_playback(tutils.tflow())
|
||||||
|
|
||||||
fm.start_server_playback(
|
|
||||||
pb,
|
|
||||||
False,
|
|
||||||
[],
|
|
||||||
True,
|
|
||||||
False,
|
|
||||||
None,
|
|
||||||
False,
|
|
||||||
None,
|
|
||||||
False)
|
|
||||||
q = queue.Queue()
|
q = queue.Queue()
|
||||||
fm.tick(q, 0)
|
fm.tick(q, 0)
|
||||||
assert fm.should_exit.is_set()
|
assert fm.should_exit.is_set()
|
||||||
|
Loading…
Reference in New Issue
Block a user