errors on closed socket are too sporadic to cover it (prevents "coverage decreased" over and over again)

pull/1460/head
sebres 2017-03-14 16:24:45 +01:00
parent 5ff63b66a0
commit ef975307c4
1 changed files with 4 additions and 2 deletions

View File

@ -138,13 +138,15 @@ def loop(active, timeout=None, use_poll=False):
break
errCount += 1
if errCount < 20:
if e.args[0] in (errno.ENOTCONN, errno.EBADF): # (errno.EBADF, 'Bad file descriptor')
# errno.ENOTCONN - 'Socket is not connected'
# errno.EBADF - 'Bad file descriptor'
if e.args[0] in (errno.ENOTCONN, errno.EBADF): # pragma: no cover (too sporadic)
logSys.info('Server connection was closed: %s', str(e))
else:
logSys.error('Server connection was closed: %s', str(e))
elif errCount == 20:
logSys.info('Too many errors - stop logging connection errors')
logSys.exception(e)
logSys.error('Too many errors - stop logging connection errors')
##