From 9d0c5886852f9f3efd0545b447470f429f72aa18 Mon Sep 17 00:00:00 2001 From: Joscha Date: Wed, 10 Apr 2019 01:00:30 +0000 Subject: [PATCH] Reset ping check on ping-events only --- yaboli/connection.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/yaboli/connection.py b/yaboli/connection.py index 137d060..aa8dd60 100644 --- a/yaboli/connection.py +++ b/yaboli/connection.py @@ -449,11 +449,12 @@ class Connection: self._events.fire(packet_type, packet) # Finally, reset the ping check - logger.debug("Resetting ping check") - if self._ping_check is not None: - self._ping_check.cancel() - self._ping_check = asyncio.create_task( - self._disconnect_in(self.PING_TIMEOUT)) + if packet_type == "ping-event": + logger.debug("Resetting ping check") + if self._ping_check is not None: + self._ping_check.cancel() + self._ping_check = asyncio.create_task( + self._disconnect_in(self.PING_TIMEOUT)) async def _do_if_possible(self, coroutine: Awaitable[None]) -> None: """