Potential fix of BrokenPipeError

This commit is contained in:
Ivanq 2020-03-17 07:54:56 +03:00
parent 6beb76eac8
commit ba156bbdec
1 changed files with 4 additions and 1 deletions

View File

@ -195,7 +195,10 @@ class WebSocket:
def close(self, status=STATUS_OK):
self.closed = True
self._send_frame(OPCODE_CLOSE, struct.pack("!H", status))
try:
self._send_frame(OPCODE_CLOSE, struct.pack("!H", status))
except (BrokenPipeError, ConnectionResetError):
pass
self.socket.close()