aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@corte.si>2017-05-14 10:28:12 +1200
committerAldo Cortesi <aldo@corte.si>2017-05-14 10:28:12 +1200
commita03a56f4dcc13e3b510dcb0f3c826b7420d15260 (patch)
treee095e44aee8bc61db002a354ab2c928c95f9effd
parentfe01adff0f21a5cf866cf55e9b0fe7cc0805a08e (diff)
downloadmitmproxy-a03a56f4dcc13e3b510dcb0f3c826b7420d15260.tar.gz
mitmproxy-a03a56f4dcc13e3b510dcb0f3c826b7420d15260.tar.bz2
mitmproxy-a03a56f4dcc13e3b510dcb0f3c826b7420d15260.zip
net.tcp: server should be in shut-down state before start
The .configure and .tick events can be called before the server is running. If an addon calls ctx.master.shutdown() at this point, the server hangs forever waiting on __is_shutdown_set. This patch fixes this by starting off with it already set.
-rw-r--r--mitmproxy/net/tcp.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/mitmproxy/net/tcp.py b/mitmproxy/net/tcp.py
index 372329d9..5ed4aa06 100644
--- a/mitmproxy/net/tcp.py
+++ b/mitmproxy/net/tcp.py
@@ -847,6 +847,7 @@ class TCPServer:
def __init__(self, address):
self.address = address
self.__is_shut_down = threading.Event()
+ self.__is_shut_down.set()
self.__shutdown_request = False
if self.address == 'localhost':