Potential fix of BrokenPipeError
This commit is contained in:
parent
6beb76eac8
commit
ba156bbdec
1 changed files with 4 additions and 1 deletions
|
@ -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()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue