Add CLOSED as an expected type (#83180)

This commit is contained in:
Joakim Sørensen
2022-12-03 16:19:16 +01:00
committed by GitHub
parent 6cef37641c
commit 0dfc0af08c

View File

@@ -214,7 +214,7 @@ class WebSocketHandler:
disconnect_warn = "Did not receive auth message within 10 seconds"
raise Disconnect from err
if msg.type in (WSMsgType.CLOSE, WSMsgType.CLOSING):
if msg.type in (WSMsgType.CLOSE, WSMsgType.CLOSED, WSMsgType.CLOSING):
raise Disconnect
if msg.type != WSMsgType.TEXT:
@@ -238,7 +238,7 @@ class WebSocketHandler:
while not wsock.closed:
msg = await wsock.receive()
if msg.type in (WSMsgType.CLOSE, WSMsgType.CLOSING):
if msg.type in (WSMsgType.CLOSE, WSMsgType.CLOSED, WSMsgType.CLOSING):
break
if msg.type != WSMsgType.TEXT: