close connection when queue overflows

This commit is contained in:
Jakob Ketterl 2019-12-08 21:11:36 +01:00
parent 61988e3297
commit 57a61f0c40

View File

@ -7,6 +7,7 @@ from owrx.bookmarks import Bookmarks
from owrx.map import Map from owrx.map import Map
from owrx.locator import Locator from owrx.locator import Locator
from multiprocessing import Queue from multiprocessing import Queue
from queue import Full
import json import json
import threading import threading
@ -39,7 +40,10 @@ class Client(object):
self.multiprocessingPipe.close() self.multiprocessingPipe.close()
def mp_send(self, data): def mp_send(self, data):
self.multiprocessingPipe.put(data, block=False) try:
self.multiprocessingPipe.put(data, block=False)
except Full:
self.close()
def handleTextMessage(self, conn, message): def handleTextMessage(self, conn, message):
pass pass