Merge pull request #1055 from youknowone/cancel-timeout

Cancel request tasks when response timeout is triggered
This commit is contained in:
Raphael Deem 2017-12-17 16:46:29 -08:00 committed by GitHub
commit 19466a15b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -174,6 +174,10 @@ class HttpProtocol(asyncio.Protocol):
self.response_timeout_callback)
)
else:
if self._request_stream_task:
self._request_stream_task.cancel()
if self._request_handler_task:
self._request_handler_task.cancel()
try:
raise ServiceUnavailable('Response Timeout')
except ServiceUnavailable as exception: