Terminate check_timeouts once connection_task finishes.

This commit is contained in:
L. Kärkkäinen 2020-02-28 19:25:03 +02:00
parent 85b1ad5732
commit 8a1baeb9d5

View File

@ -202,6 +202,8 @@ class HttpProtocol(asyncio.Protocol):
def check_timeouts(self): def check_timeouts(self):
"""Runs itself once a second to enforce any expired timeouts.""" """Runs itself once a second to enforce any expired timeouts."""
if not self._task:
return
duration = current_time() - self._time duration = current_time() - self._time
lifespan = self._http.lifespan lifespan = self._http.lifespan
if lifespan == Lifespan.IDLE and duration > self.keep_alive_timeout: if lifespan == Lifespan.IDLE and duration > self.keep_alive_timeout: