diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2018-04-02 14:51:14 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2018-04-02 14:51:14 +1200 |
commit | a3da43d3e5d5b2ca243971e586aeee4969b6d053 (patch) | |
tree | acb373bbe09a3c66e99f3b7585d444c2bd17d87f /mitmproxy/master.py | |
parent | 2ac4f9e25514c46f01d1667afa808e274658abaa (diff) | |
download | mitmproxy-a3da43d3e5d5b2ca243971e586aeee4969b6d053.tar.gz mitmproxy-a3da43d3e5d5b2ca243971e586aeee4969b6d053.tar.bz2 mitmproxy-a3da43d3e5d5b2ca243971e586aeee4969b6d053.zip |
asyncio: test cleanup
Also silence asyncio logs. We sometimes end up with messages on the queue that
need to be ignored when the proxy shuts down, and asyncio complains loudly
about this.
Diffstat (limited to 'mitmproxy/master.py')
-rw-r--r-- | mitmproxy/master.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/mitmproxy/master.py b/mitmproxy/master.py index c22a78e4..022590d4 100644 --- a/mitmproxy/master.py +++ b/mitmproxy/master.py @@ -1,6 +1,7 @@ import threading import contextlib import asyncio +import logging from mitmproxy import addonmanager from mitmproxy import options @@ -18,6 +19,13 @@ from mitmproxy.coretypes import basethread from . import ctx as mitmproxy_ctx +# Conclusively preventing cross-thread races on proxy shutdown turns out to be +# very hard. We could build a thread sync infrastructure for this, or we could +# wait until we ditch threads and move all the protocols into the async loop. +# Until then, silence non-critical errors. +logging.getLogger('asyncio').setLevel(logging.CRITICAL) + + class ServerThread(basethread.BaseThread): def __init__(self, server): self.server = server |