From d8301ff51261e6a37ec6ac103fb1d508d117091e Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Sun, 26 Feb 2017 20:29:07 +0100 Subject: [PATCH] Less verbose connection error reporting - don't print tracebacks on normal (timeout/reset) errors --- src/class_sendDataThread.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/class_sendDataThread.py b/src/class_sendDataThread.py index 05dc5c34..a59a628e 100644 --- a/src/class_sendDataThread.py +++ b/src/class_sendDataThread.py @@ -96,7 +96,8 @@ class sendDataThread(threading.Thread): select.select([], [self.sslSock], [], 10) logger.debug('sock.recv retriable SSL error') continue - raise + logger.debug('Connection error (SSL)') + return False except socket.error as e: if e.errno in (errno.EAGAIN, errno.EWOULDBLOCK) or \ (sys.platform.startswith('win') and \ @@ -104,8 +105,8 @@ class sendDataThread(threading.Thread): select.select([], [self.sslSock if isSSL else self.sock], [], 10) logger.debug('sock.recv retriable error') continue - if e.errno == errno.EPIPE: - logger.debug('Connection broken') + if e.errno in (errno.EPIPE, errno.ECONNRESET): + logger.debug('Connection error (EPIPE/ECONNRESET)') return False raise throttle.SendThrottle().wait(amountSent)