Skip to content

Commit

Permalink
transport.producer.loseConnection() → transport.loseConnection() (#4995)
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielztk committed Oct 13, 2022
1 parent da9a2f8 commit 715c05d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions scrapy/core/downloader/handlers/http11.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,7 @@ def _cb_bodyready(self, txresponse, request):
logger.debug("Download stopped for %(request)s from signal handler %(handler)s",
{"request": request, "handler": handler.__qualname__})
txresponse._transport.stopProducing()
with suppress(AttributeError):
txresponse._transport._producer.loseConnection()
txresponse._transport.loseConnection()
return {
"txresponse": txresponse,
"body": b"",
Expand Down Expand Up @@ -417,7 +416,7 @@ def _cb_bodyready(self, txresponse, request):

logger.warning(warning_msg, warning_args)

txresponse._transport._producer.loseConnection()
txresponse._transport.loseConnection()
raise defer.CancelledError(warning_msg % warning_args)

if warnsize and expected_size > warnsize:
Expand Down Expand Up @@ -543,7 +542,7 @@ def dataReceived(self, bodyBytes):
logger.debug("Download stopped for %(request)s from signal handler %(handler)s",
{"request": self._request, "handler": handler.__qualname__})
self.transport.stopProducing()
self.transport._producer.loseConnection()
self.transport.loseConnection()
failure = result if result.value.fail else None
self._finish_response(flags=["download_stopped"], failure=failure)

Expand Down

0 comments on commit 715c05d

Please sign in to comment.