diff --git a/src/lib/gevent_ws/__init__.py b/src/lib/gevent_ws/__init__.py index 515428350..8f0810bb2 100644 --- a/src/lib/gevent_ws/__init__.py +++ b/src/lib/gevent_ws/__init__.py @@ -195,7 +195,10 @@ def _error(self, status): 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()