only handle exception if still active

This commit is contained in:
j 2014-09-03 00:33:42 +02:00
parent f5bb5ee877
commit 14f426afd4

View file

@ -85,11 +85,13 @@ class LocalNodesBase(Thread):
if data: if data:
self.update_node(data) self.update_node(data)
except socket.timeout: except socket.timeout:
if self._active:
now = time.mktime(time.localtime()) now = time.mktime(time.localtime())
if now - last > 60: if now - last > 60:
last = now last = now
thread.start_new_thread(self.send, ()) thread.start_new_thread(self.send, ())
except: except:
if self._active:
logger.debug('receive failed. restart later', exc_info=1) logger.debug('receive failed. restart later', exc_info=1)
time.sleep(10) time.sleep(10)