Windows compatibility fixes

- there is no errno.WSAEAGAIN, only errno.WSAEWOULDBLOCK
This commit is contained in:
Peter Šurda 2017-02-14 01:38:58 +01:00
parent a4b1a781ce
commit f94b2d2d4b
Signed by: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87
2 changed files with 6 additions and 10 deletions

View File

@ -116,11 +116,9 @@ class receiveDataThread(threading.Thread):
logger.error ('SSL error: %i/%s', err.errno if err.errno else 0, str(err))
break
except socket.error as err:
if err.errno in (errno.EAGAIN, errno.EWOULDBLOCK):
select.select([self.sslSock if isSSL else self.sock], [], [], 10)
logger.debug('sock.recv retriable error')
continue
if sys.platform.startswith('win') and err.errno in (errno.WSAEAGAIN, errno.WSAEWOULDBLOCK):
if err.errno in (errno.EAGAIN, errno.EWOULDBLOCK) or \
(sys.platform.startswith('win') and \
err.errno in (errno.WSAEWOULDBLOCK)):
select.select([self.sslSock if isSSL else self.sock], [], [], 10)
logger.debug('sock.recv retriable error')
continue

View File

@ -98,11 +98,9 @@ class sendDataThread(threading.Thread):
continue
raise
except socket.error as e:
if e.errno in (errno.EAGAIN, errno.EWOULDBLOCK):
select.select([], [self.sslSock if isSSL else self.sock], [], 10)
logger.debug('sock.recv retriable error')
continue
if sys.platform.startswith('win') and e.errno in (errno.WSAEAGAIN, errno.WSAEWOULDBLOCK):
if e.errno in (errno.EAGAIN, errno.EWOULDBLOCK) or \
(sys.platform.startswith('win') and \
e.errno in (errno.WSAEWOULDBLOCK)):
select.select([], [self.sslSock if isSSL else self.sock], [], 10)
logger.debug('sock.recv retriable error')
continue