Add EINTR handler for select and poll pollers

This commit is contained in:
Peter Šurda 2017-07-21 09:06:02 +02:00
parent 2530c62050
commit a29f7534ee
Signed by: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87

View File

@ -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: