improved error handling, refs #146 #22

This commit is contained in:
Jakob Ketterl 2020-07-19 19:00:26 +02:00
parent 174e9afa7b
commit c54f19282a
3 changed files with 6 additions and 3 deletions

View File

@ -240,5 +240,5 @@ class AudioChopper(threading.Thread, metaclass=ABCMeta):
try: try:
readers = wait([w.outputReader for w in self.writers]) readers = wait([w.outputReader for w in self.writers])
return [r.recv() for r in readers] return [r.recv() for r in readers]
except EOFError: except (EOFError, OSError):
return None return None

View File

@ -41,7 +41,10 @@ class Client(ABC):
threading.Thread(target=mp_passthru).start() threading.Thread(target=mp_passthru).start()
def send(self, data): def send(self, data):
self.conn.send(data) try:
self.conn.send(data)
except IOError:
self.close()
def close(self): def close(self):
self.conn.close() self.conn.close()

View File

@ -16,7 +16,7 @@ OPCODE_PING = 0x09
OPCODE_PONG = 0x0A OPCODE_PONG = 0x0A
class WebSocketException(Exception): class WebSocketException(IOError):
pass pass