mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-30 03:14:22 +00:00
tcp: As of Python 3.5, EINTR is retried automatically by select
See https://www.python.org/dev/peps/pep-0475/
This commit is contained in:
parent
8396244729
commit
bca0275427
@ -22,8 +22,6 @@ socket_fileobject = socket.SocketIO
|
|||||||
# Python 3.6 for Windows is missing a constant
|
# Python 3.6 for Windows is missing a constant
|
||||||
IPPROTO_IPV6 = getattr(socket, "IPPROTO_IPV6", 41)
|
IPPROTO_IPV6 = getattr(socket, "IPPROTO_IPV6", 41)
|
||||||
|
|
||||||
EINTR = 4
|
|
||||||
|
|
||||||
|
|
||||||
class _FileLike:
|
class _FileLike:
|
||||||
BLOCKSIZE = 1024 * 32
|
BLOCKSIZE = 1024 * 32
|
||||||
@ -595,14 +593,7 @@ class TCPServer:
|
|||||||
self.__is_shut_down.clear()
|
self.__is_shut_down.clear()
|
||||||
try:
|
try:
|
||||||
while not self.__shutdown_request:
|
while not self.__shutdown_request:
|
||||||
try:
|
r, w_, e_ = select.select([self.socket], [], [], poll_interval)
|
||||||
r, w_, e_ = select.select(
|
|
||||||
[self.socket], [], [], poll_interval)
|
|
||||||
except select.error as ex: # pragma: no cover
|
|
||||||
if ex[0] == EINTR:
|
|
||||||
continue
|
|
||||||
else:
|
|
||||||
raise
|
|
||||||
if self.socket in r:
|
if self.socket in r:
|
||||||
connection, client_address = self.socket.accept()
|
connection, client_address = self.socket.accept()
|
||||||
t = basethread.BaseThread(
|
t = basethread.BaseThread(
|
||||||
|
Loading…
Reference in New Issue
Block a user