Merge pull request #2483 from imachug/gevent-ws-fix
Potential fix of BrokenPipeError
This commit is contained in:
commit
3156d2f94b
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