From a29f7534ee54a6b93498ec13e581ee2da22dfc94 Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Fri, 21 Jul 2017 09:06:02 +0200 Subject: [PATCH] Add EINTR handler for select and poll pollers --- src/network/asyncore_pollchoose.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/network/asyncore_pollchoose.py b/src/network/asyncore_pollchoose.py index c1296744..3b21d3da 100644 --- a/src/network/asyncore_pollchoose.py +++ b/src/network/asyncore_pollchoose.py @@ -203,7 +203,7 @@ def select_poller(timeout=0.0, map=None): except KeyboardInterrupt: return except socket.error as err: - if err.args[0] in (EBADF, WSAENOTSOCK): + if err.args[0] in (EBADF, WSAENOTSOCK, EINTR): return for fd in random.sample(r, len(r)): @@ -263,6 +263,9 @@ def poll_poller(timeout=0.0, map=None): r = poll_poller.pollster.poll(timeout) except KeyboardInterrupt: r = [] + except socket.error as err: + if err.args[0] in (EBADF, WSAENOTSOCK, EINTR): + return for fd, flags in random.sample(r, len(r)): obj = map.get(fd) if obj is None: