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:
PavelICS 2022-01-10 17:58:14 +03:00 committed by GitHub
parent 000e26674e
commit 1e97073078
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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.