From e77d2975afda3750104c90b7c0012c02a2a00b10 Mon Sep 17 00:00:00 2001 From: light94 Date: Sun, 1 Feb 2015 00:10:58 +0530 Subject: [PATCH] Handling Connection Reset by Peer Error --- youtube_dl/downloader/http.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/youtube_dl/downloader/http.py b/youtube_dl/downloader/http.py index 8a1d578d5..9b023c5c1 100644 --- a/youtube_dl/downloader/http.py +++ b/youtube_dl/downloader/http.py @@ -3,6 +3,9 @@ import os import time +from socket import error as SocketError +import errno + from .common import FileDownloader from ..compat import ( compat_urllib_request, @@ -99,6 +102,11 @@ def real_download(self, filename, info_dict): resume_len = 0 open_mode = 'wb' break + + except SocketError as e: + if e.errno != errno.ECONNRESET: + raise # Not error we are looking for + pass # Retry count += 1 if count <= retries: