Don't complain when attempting to close sockets at this stage

This commit is contained in:
Pedro Algarvio 2019-05-27 11:45:26 +01:00
parent e3f3cc9b66
commit 6bf8f46df3
No known key found for this signature in database
GPG Key ID: BB36BF6584A298FF

View File

@ -97,8 +97,11 @@ def process_queue(port, queue):
# logging handlers
sock.sendall(msgpack.dumps(record.__dict__, encoding='utf-8'))
except (IOError, EOFError, KeyboardInterrupt, SystemExit):
sock.shutdown(socket.SHUT_RDWR)
sock.close()
try:
sock.shutdown(socket.SHUT_RDWR)
sock.close()
except (OSError, socket.error):
pass
break
except socket.error as exc:
if exc.errno == errno.EPIPE:
@ -106,7 +109,7 @@ def process_queue(port, queue):
try:
sock.shutdown(socket.SHUT_RDWR)
sock.close()
except OSError:
except (OSError, socket.error):
pass
break
log.exception(exc)