mirror of
https://github.com/Flowseal/tg-ws-proxy.git
synced 2026-11-01 17:16:58 +03:00
Fixes #1517
This commit is contained in:
1 parent
50d539c718
commit
1636903c8f
6 files changed
+319
-29
No files matched your search
+14
-13
@@ -225,20 +225,21 @@ class RawWebSocket:
|
||||
return None
|
||||
|
||||
async def close(self):
|
||||
if self._closed:
|
||||
return
|
||||
self._closed = True
|
||||
try:
|
||||
self.writer.write(
|
||||
self._build_frame(self.OP_CLOSE, b'', mask=True))
|
||||
await self.writer.drain()
|
||||
except Exception:
|
||||
pass
|
||||
try:
|
||||
self.writer.close()
|
||||
await self.writer.wait_closed()
|
||||
except Exception:
|
||||
pass
|
||||
if not self._closed:
|
||||
self._closed = True
|
||||
try:
|
||||
self.writer.write(
|
||||
self._build_frame(self.OP_CLOSE, b'', mask=True))
|
||||
await self.writer.drain()
|
||||
except Exception:
|
||||
pass
|
||||
finally:
|
||||
try:
|
||||
self.writer.close()
|
||||
await self.writer.wait_closed()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
_WS_CLOSE_REASONS = {
|
||||
1000: 'normal', 1001: 'going_away', 1002: 'protocol_error',
|
||||
|
||||
Reference in new issue
Block a user