Close HTTP loop when connection task cancelled (#2245)
* Terminate loop when no transport exists * Add log when closing HTTP loop because of shutdown * Add unit test
This commit is contained in:
@@ -109,7 +109,7 @@ class HttpProtocol(SanicProtocol, metaclass=TouchUpMeta):
|
||||
except Exception:
|
||||
error_logger.exception("protocol.connection_task uncaught")
|
||||
finally:
|
||||
if self.app.debug and self._http:
|
||||
if self.app.debug and self._http and self.transport:
|
||||
ip = self.transport.get_extra_info("peername")
|
||||
error_logger.error(
|
||||
"Connection lost before response written"
|
||||
|
||||
Reference in New Issue
Block a user