mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-22 07:08:10 +00:00
Fix crush shutdown when MITM has it's own loop (#5042)
When I call shutdown with a different loop in the current thread from MITM loop, it's crashes with the error: `ValueError: The future belongs to a different loop than the one specified as the loop argument` Setting a loop explicit fixes the problem.
This commit is contained in:
parent
000e26674e
commit
1e97073078
@ -92,7 +92,7 @@ class Master:
|
||||
# This all needs to be simplified when the proxy server runs on asyncio as well.
|
||||
if not self.event_loop.is_running(): # pragma: no cover
|
||||
try:
|
||||
self.event_loop.run_until_complete(asyncio.wrap_future(ret))
|
||||
self.event_loop.run_until_complete(asyncio.wrap_future(ret, loop=self.event_loop))
|
||||
except RuntimeError:
|
||||
pass # Event loop stopped before Future completed.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user