From 1f33c1c1a54e466f903cc69a2e086d699515cad8 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Mon, 2 Apr 2018 15:00:13 +1200 Subject: [PATCH] asyncio: rebase mitmweb Tornado event loop on asyncio --- mitmproxy/tools/web/master.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mitmproxy/tools/web/master.py b/mitmproxy/tools/web/master.py index 4c597f0e5..843190e06 100644 --- a/mitmproxy/tools/web/master.py +++ b/mitmproxy/tools/web/master.py @@ -2,6 +2,9 @@ import webbrowser import tornado.httpserver import tornado.ioloop +from tornado.platform.asyncio import AsyncIOMainLoop +import asyncio + from mitmproxy import addons from mitmproxy import log from mitmproxy import master @@ -102,6 +105,7 @@ class WebMaster(master.Master): ) def run(self): # pragma: no cover + AsyncIOMainLoop().install() iol = tornado.ioloop.IOLoop.instance() @@ -109,7 +113,6 @@ class WebMaster(master.Master): http_server.listen(self.options.web_port, self.options.web_iface) iol.add_callback(self.start) - tornado.ioloop.PeriodicCallback(lambda: self.tick(timeout=0), 5).start() web_url = "http://{}:{}/".format(self.options.web_iface, self.options.web_port) self.add_log(