Reset ping check on ping-events only

This commit is contained in:
Joscha 2019-04-10 01:00:30 +00:00
parent bf736430a6
commit 9d0c588685

View file

@ -449,11 +449,12 @@ class Connection:
self._events.fire(packet_type, packet) self._events.fire(packet_type, packet)
# Finally, reset the ping check # Finally, reset the ping check
logger.debug("Resetting ping check") if packet_type == "ping-event":
if self._ping_check is not None: logger.debug("Resetting ping check")
self._ping_check.cancel() if self._ping_check is not None:
self._ping_check = asyncio.create_task( self._ping_check.cancel()
self._disconnect_in(self.PING_TIMEOUT)) self._ping_check = asyncio.create_task(
self._disconnect_in(self.PING_TIMEOUT))
async def _do_if_possible(self, coroutine: Awaitable[None]) -> None: async def _do_if_possible(self, coroutine: Awaitable[None]) -> None:
""" """