From fd12dbb8d4cfc346e4a221dfa604006476cee199 Mon Sep 17 00:00:00 2001 From: Ali <> Date: Sat, 2 Nov 2019 23:04:00 +0400 Subject: [PATCH] Retry download requests after failure --- .../TelegramCore/Sources/Download.swift | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/submodules/TelegramCore/Sources/Download.swift b/submodules/TelegramCore/Sources/Download.swift index 472806c414..af3260e1f6 100644 --- a/submodules/TelegramCore/Sources/Download.swift +++ b/submodules/TelegramCore/Sources/Download.swift @@ -119,6 +119,10 @@ class Download: NSObject, MTRequestMessageServiceDelegate { request.dependsOnPasswordEntry = false + request.shouldContinueExecutionWithErrorContext = { errorContext in + return true + } + request.completed = { (boxedResponse, timestamp, error) -> () in if let error = error { subscriber.putError(error) @@ -163,6 +167,10 @@ class Download: NSObject, MTRequestMessageServiceDelegate { request.dependsOnPasswordEntry = false + request.shouldContinueExecutionWithErrorContext = { errorContext in + return true + } + request.completed = { (boxedResponse, timestamp, error) -> () in if let error = error { subscriber.putError(error) @@ -210,6 +218,10 @@ class Download: NSObject, MTRequestMessageServiceDelegate { request.dependsOnPasswordEntry = false + request.shouldContinueExecutionWithErrorContext = { errorContext in + return true + } + request.completed = { (boxedResponse, timestamp, error) -> () in if let error = error { subscriber.putError(error) @@ -253,6 +265,10 @@ class Download: NSObject, MTRequestMessageServiceDelegate { request.dependsOnPasswordEntry = false + request.shouldContinueExecutionWithErrorContext = { errorContext in + return true + } + request.completed = { (boxedResponse, timestamp, error) -> () in if let error = error { subscriber.putError(error) @@ -291,6 +307,10 @@ class Download: NSObject, MTRequestMessageServiceDelegate { request.dependsOnPasswordEntry = false + request.shouldContinueExecutionWithErrorContext = { errorContext in + return true + } + request.completed = { (boxedResponse, timestamp, error) -> () in if let error = error { subscriber.putError(error)