| 342 | transport.handler.cancel(f"Error sending data: {e}") |
| 343 | |
| 344 | async def on_timeout(self) -> None: |
| 345 | try: |
| 346 | handler = self.transports[self.client].handler |
| 347 | except KeyError: # pragma: no cover |
| 348 | # there is a super short window between connection close and watchdog cancellation |
| 349 | pass |
| 350 | else: |
| 351 | if self.client.transport_protocol == "tcp": |
| 352 | self.log(f"Closing connection due to inactivity: {self.client}") |
| 353 | assert handler |
| 354 | handler.cancel("timeout") |
| 355 | |
| 356 | async def hook_task(self, hook: commands.StartHook) -> None: |
| 357 | await self.handle_hook(hook) |