From aa059d6f2fd45ec0d7de7bb2cd0477ff3552eb14 Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Fri, 21 Jul 2017 07:47:18 +0200 Subject: [PATCH] Handle TLS errors in receivequeuethread - well at least EBADF, it seems to happen sometimes --- src/network/receivequeuethread.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/network/receivequeuethread.py b/src/network/receivequeuethread.py index a899851f..a617e16e 100644 --- a/src/network/receivequeuethread.py +++ b/src/network/receivequeuethread.py @@ -1,4 +1,6 @@ +import errno import Queue +import socket import sys import threading import time @@ -43,4 +45,9 @@ class ReceiveQueueThread(threading.Thread, StoppableThread): # AttributeError = state isn't implemented except (KeyError, AttributeError): 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()