From bca0275427e5879e49cd91d0802e51052a8000d1 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Wed, 18 Apr 2018 08:22:26 +1200 Subject: [PATCH] tcp: As of Python 3.5, EINTR is retried automatically by select See https://www.python.org/dev/peps/pep-0475/ --- mitmproxy/net/tcp.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/mitmproxy/net/tcp.py b/mitmproxy/net/tcp.py index b842f11f2..5e53e398f 100644 --- a/mitmproxy/net/tcp.py +++ b/mitmproxy/net/tcp.py @@ -22,8 +22,6 @@ socket_fileobject = socket.SocketIO # Python 3.6 for Windows is missing a constant IPPROTO_IPV6 = getattr(socket, "IPPROTO_IPV6", 41) -EINTR = 4 - class _FileLike: BLOCKSIZE = 1024 * 32 @@ -595,14 +593,7 @@ class TCPServer: self.__is_shut_down.clear() try: while not self.__shutdown_request: - try: - r, w_, e_ = select.select( - [self.socket], [], [], poll_interval) - except select.error as ex: # pragma: no cover - if ex[0] == EINTR: - continue - else: - raise + r, w_, e_ = select.select([self.socket], [], [], poll_interval) if self.socket in r: connection, client_address = self.socket.accept() t = basethread.BaseThread(