Skip to content

Commit

Permalink
never let it leak
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco committed Dec 17, 2023
1 parent 56fe7eb commit dd4c3b4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions aiohttp/web_ws.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,12 +496,15 @@ async def receive(self, timeout: Optional[float] = None) -> WSMessage:
self._closing = True
self._close_code = msg.data
# Could be closed while awaiting reader.
if not self._closed and self._autoclose: # type: ignore[redundant-expr]
if not self._closed:
# The client is going to close the connection
# out from under us so we do not want to drain
# any pending writes as it will likely result
# writing to a broken pipe.
await self.close(drain=False)
if self._autoclose:
await self.close(drain=False)
else:
self._set_code_close_transport(msg.data)
elif msg.type == WSMsgType.CLOSING:
self._closing = True
elif msg.type == WSMsgType.PING and self._autoping:
Expand Down

0 comments on commit dd4c3b4

Please sign in to comment.