From c2e5674a73708fa171a1c599d29a626af5c67b31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=2E=20K=C3=A4rkk=C3=A4inen?= Date: Mon, 2 Mar 2020 16:55:48 +0200 Subject: [PATCH] Add a missing check in case of close_if_idle on a dead connection. --- sanic/server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sanic/server.py b/sanic/server.py index c7f55f4a..c0c5ff4a 100644 --- a/sanic/server.py +++ b/sanic/server.py @@ -192,7 +192,7 @@ class HttpProtocol(asyncio.Protocol): :return: boolean - True if closed, false if staying open """ - if self._http.stage is Stage.IDLE: + if self._http is None or self._http.stage is Stage.IDLE: self.close() return True return False