Skip to content

Commit 14d1e03

Browse files
trio_websocket/_impl.py: Don't reply to pings on a locally closed
connection
1 parent bec4232 commit 14d1e03

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

trio_websocket/_impl.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1495,7 +1495,8 @@ async def _handle_ping_event(self, event: wsproto.events.Ping) -> None:
14951495
:param wsproto.events.Ping event:
14961496
'''
14971497
logger.debug('%s ping %r', self, event.payload)
1498-
await self._send(event.response())
1498+
if self._wsproto.state != ConnectionState.LOCAL_CLOSING:
1499+
await self._send(event.response())
14991500

15001501
async def _handle_pong_event(self, event: wsproto.events.Pong) -> None:
15011502
'''

0 commit comments

Comments
 (0)