From ba156bbdec26b8dcc5cc943e7b795f23a4789ad0 Mon Sep 17 00:00:00 2001 From: Ivanq Date: Tue, 17 Mar 2020 07:54:56 +0300 Subject: [PATCH] Potential fix of BrokenPipeError --- src/lib/gevent_ws/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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()