[http] Retry on socket timeout

Closes #1222
This commit is contained in:
pukkandan 2021-10-19 18:52:17 +05:30
parent e619d8a752
commit 9fab498fbf
No known key found for this signature in database
GPG Key ID: 0F00D95A001F4698
1 changed files with 6 additions and 4 deletions

View File

@ -191,11 +191,13 @@ class HttpFD(FileDownloader):
# Unexpected HTTP error
raise
raise RetryDownload(err)
except socket.error as err:
if err.errno != errno.ECONNRESET:
# Connection reset is no problem, just retry
raise
except socket.timeout as err:
raise RetryDownload(err)
except socket.error as err:
if err.errno in (errno.ECONNRESET, errno.ETIMEDOUT):
# Connection reset is no problem, just retry
raise RetryDownload(err)
raise
def download():
nonlocal throttle_start