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 untrusted user: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87

View File

@ -203,7 +203,7 @@ def select_poller(timeout=0.0, map=None):
except KeyboardInterrupt: except KeyboardInterrupt:
return return
except socket.error as err: except socket.error as err:
if err.args[0] in (EBADF, WSAENOTSOCK): if err.args[0] in (EBADF, WSAENOTSOCK, EINTR):
return return
for fd in random.sample(r, len(r)): 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) r = poll_poller.pollster.poll(timeout)
except KeyboardInterrupt: except KeyboardInterrupt:
r = [] r = []
except socket.error as err:
if err.args[0] in (EBADF, WSAENOTSOCK, EINTR):
return
for fd, flags in random.sample(r, len(r)): for fd, flags in random.sample(r, len(r)):
obj = map.get(fd) obj = map.get(fd)
if obj is None: if obj is None: