MCPcopy
hub / github.com/mitmproxy/mitmproxy / on_timeout

Method on_timeout

mitmproxy/proxy/server.py:344–354  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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)

Callers

nothing calls this directly

Calls 1

logMethod · 0.95

Tested by

no test coverage detected