Handle TLS errors in receivequeuethread

- well at least EBADF, it seems to happen sometimes
This commit is contained in:
Peter Šurda 2017-07-21 07:47:18 +02:00
parent 4f19c37fdc
commit aa059d6f2f
Signed by: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87

View File

@ -1,4 +1,6 @@
import errno
import Queue import Queue
import socket
import sys import sys
import threading import threading
import time import time
@ -43,4 +45,9 @@ class ReceiveQueueThread(threading.Thread, StoppableThread):
# AttributeError = state isn't implemented # AttributeError = state isn't implemented
except (KeyError, AttributeError): except (KeyError, AttributeError):
pass pass
except socket.error as err:
if err.errno == errno.EBADF:
BMConnectionPool().getConnectionByAddr(dest).set_state("close", 0)
else:
logger.error("Socket error: %s", str(err))
receiveDataQueue.task_done() receiveDataQueue.task_done()