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 untrusted user: 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)) logger.error ('SSL error: %i/%s', err.errno if err.errno else 0, str(err))
break break
except socket.error as err: except socket.error as err:
if err.errno in (errno.EAGAIN, errno.EWOULDBLOCK): if err.errno in (errno.EAGAIN, errno.EWOULDBLOCK) or \
select.select([self.sslSock if isSSL else self.sock], [], [], 10) (sys.platform.startswith('win') and \
logger.debug('sock.recv retriable error') err.errno in (errno.WSAEWOULDBLOCK)):
continue
if sys.platform.startswith('win') and err.errno in (errno.WSAEAGAIN, errno.WSAEWOULDBLOCK):
select.select([self.sslSock if isSSL else self.sock], [], [], 10) select.select([self.sslSock if isSSL else self.sock], [], [], 10)
logger.debug('sock.recv retriable error') logger.debug('sock.recv retriable error')
continue continue

View File

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