diff --git a/owrx/audio.py b/owrx/audio.py index a8c2880..b77ad7c 100644 --- a/owrx/audio.py +++ b/owrx/audio.py @@ -240,5 +240,5 @@ class AudioChopper(threading.Thread, metaclass=ABCMeta): try: readers = wait([w.outputReader for w in self.writers]) return [r.recv() for r in readers] - except EOFError: + except (EOFError, OSError): return None diff --git a/owrx/connection.py b/owrx/connection.py index 8e3407d..f3e951e 100644 --- a/owrx/connection.py +++ b/owrx/connection.py @@ -41,7 +41,10 @@ class Client(ABC): threading.Thread(target=mp_passthru).start() def send(self, data): - self.conn.send(data) + try: + self.conn.send(data) + except IOError: + self.close() def close(self): self.conn.close() diff --git a/owrx/websocket.py b/owrx/websocket.py index fc6462d..de34141 100644 --- a/owrx/websocket.py +++ b/owrx/websocket.py @@ -16,7 +16,7 @@ OPCODE_PING = 0x09 OPCODE_PONG = 0x0A -class WebSocketException(Exception): +class WebSocketException(IOError): pass