From a03a56f4dcc13e3b510dcb0f3c826b7420d15260 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sun, 14 May 2017 10:28:12 +1200 Subject: [PATCH] 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. --- mitmproxy/net/tcp.py | 1 + 1 file changed, 1 insertion(+) diff --git a/mitmproxy/net/tcp.py b/mitmproxy/net/tcp.py index 372329d9b..5ed4aa06b 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':