diff --git a/sanic/server/protocols/http_protocol.py b/sanic/server/protocols/http_protocol.py index 1eb692ecaf..4cc4c3f8ef 100644 --- a/sanic/server/protocols/http_protocol.py +++ b/sanic/server/protocols/http_protocol.py @@ -278,7 +278,7 @@ def close_if_idle(self) -> bool: :return: boolean - True if closed, false if staying open """ - if self._http is None or self._http.stage is Stage.IDLE: + if self.http is None or self.http.stage is Stage.IDLE: self.close() return True return False