Fix broken bail_out when HttpProtocol is closed

This commit is contained in:
andreymal 2019-04-19 16:00:01 +03:00
parent df23692802
commit 99e56ef74b
No known key found for this signature in database
GPG Key ID: CB605DA977D27A93

View File

@ -554,11 +554,15 @@ class HttpProtocol(asyncio.Protocol):
:return: None
"""
if from_error or self.transport.is_closing():
if from_error or self.transport is None or self.transport.is_closing():
logger.error(
"Transport closed @ %s and exception "
"experienced during error handling",
self.transport.get_extra_info("peername"),
(
self.transport.get_extra_info("peername")
if self.transport is not None
else "N/A"
),
)
logger.debug("Exception:", exc_info=True)
else: