Connection error reporting changes
- fewer tracebacks - more standardised reports including errno
This commit is contained in:
parent
4014b80b7c
commit
3ac67e5da7
|
@ -123,11 +123,11 @@ class receiveDataThread(threading.Thread):
|
||||||
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
|
||||||
logger.error('sock.recv error. Closing receiveData thread (' + str(self.peer) + ', Thread ID: ' + str(id(self)) + ').' + str(err.errno) + "/" + str(err))
|
logger.error('sock.recv error. Closing receiveData thread, %s', str(err))
|
||||||
break
|
break
|
||||||
# print 'Received', repr(self.data)
|
# print 'Received', repr(self.data)
|
||||||
if len(self.data) == dataLen: # If self.sock.recv returned no data:
|
if len(self.data) == dataLen: # If self.sock.recv returned no data:
|
||||||
logger.debug('Connection to ' + str(self.peer) + ' closed. Closing receiveData thread. (ID: ' + str(id(self)) + ')')
|
logger.debug('Connection to ' + str(self.peer) + ' closed. Closing receiveData thread')
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
self.processData()
|
self.processData()
|
||||||
|
@ -302,9 +302,13 @@ class receiveDataThread(threading.Thread):
|
||||||
logger.debug("Waiting for SSL socket handhake write")
|
logger.debug("Waiting for SSL socket handhake write")
|
||||||
select.select([], [self.sslSock], [], 10)
|
select.select([], [self.sslSock], [], 10)
|
||||||
continue
|
continue
|
||||||
logger.error("SSL socket handhake failed: %s, shutting down connection", str(e))
|
logger.error("SSL socket handhake failed: shutting down connection, %s", str(e))
|
||||||
self.sendDataThreadQueue.put((0, 'shutdown','tls handshake fail %s' % (str(e))))
|
self.sendDataThreadQueue.put((0, 'shutdown','tls handshake fail %s' % (str(e))))
|
||||||
return False
|
return False
|
||||||
|
except socket.error as err:
|
||||||
|
logger.debug('SSL socket handshake failed, shutting down connection, %s', str(err))
|
||||||
|
self.sendDataThreadQueue.put((0, 'shutdown','tls handshake fail'))
|
||||||
|
return False
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.error("SSL socket handhake failed, shutting down connection", exc_info=True)
|
logger.error("SSL socket handhake failed, shutting down connection", exc_info=True)
|
||||||
self.sendDataThreadQueue.put((0, 'shutdown','tls handshake fail'))
|
self.sendDataThreadQueue.put((0, 'shutdown','tls handshake fail'))
|
||||||
|
|
|
@ -105,8 +105,8 @@ class sendDataThread(threading.Thread):
|
||||||
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
|
||||||
if e.errno in (errno.EPIPE, errno.ECONNRESET, errno.EHOSTUNREACH, errno.ETIMEDOUT):
|
if e.errno in (errno.EPIPE, errno.ECONNRESET, errno.EHOSTUNREACH, errno.ETIMEDOUT, errno.ECONNREFUSED):
|
||||||
logger.debug('Connection error (EPIPE/ECONNRESET/EHOSTUNREACH/ETIMEDOUT)')
|
logger.debug('Connection error: %s', str(e))
|
||||||
return False
|
return False
|
||||||
raise
|
raise
|
||||||
throttle.SendThrottle().wait(amountSent)
|
throttle.SendThrottle().wait(amountSent)
|
||||||
|
|
Reference in New Issue
Block a user