From f94b2d2d4b61fd7a74882d4cb70740dafdf142b1 Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Tue, 14 Feb 2017 01:38:58 +0100 Subject: [PATCH] Windows compatibility fixes - there is no errno.WSAEAGAIN, only errno.WSAEWOULDBLOCK --- src/class_receiveDataThread.py | 8 +++----- src/class_sendDataThread.py | 8 +++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/class_receiveDataThread.py b/src/class_receiveDataThread.py index 987d7573..c3b37865 100644 --- a/src/class_receiveDataThread.py +++ b/src/class_receiveDataThread.py @@ -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 diff --git a/src/class_sendDataThread.py b/src/class_sendDataThread.py index e403de61..667850cd 100644 --- a/src/class_sendDataThread.py +++ b/src/class_sendDataThread.py @@ -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