Merge pull request #2483 from imachug/gevent-ws-fix

Potential fix of BrokenPipeError
This commit is contained in:
ZeroNet 2020-03-17 14:25:11 +01:00 committed by GitHub
commit 3156d2f94b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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()