From 11f181aa317b2ffc2dd3488700d18adeb57537ca Mon Sep 17 00:00:00 2001 From: Johnny Bueti <29045904+Fehniix@users.noreply.github.com> Date: Tue, 25 Jan 2022 10:34:12 +0100 Subject: [PATCH] fix: 408 status retry counter - Fixed DRL status fail counter decreased in case of HTTP 408 error --- .../Services/CRLSynchronizationManager.swift | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/DGCAVerifier/Services/CRLSynchronizationManager.swift b/DGCAVerifier/Services/CRLSynchronizationManager.swift index 6bb301b..6fcb2e0 100644 --- a/DGCAVerifier/Services/CRLSynchronizationManager.swift +++ b/DGCAVerifier/Services/CRLSynchronizationManager.swift @@ -160,9 +160,9 @@ class CRLSynchronizationManager { delegate?.statusDidChange(with: .completed) } - func handleRetry(){ - CRLSynchronizationManager.shared.crlFailCounter -= 1 - if CRLSynchronizationManager.shared.crlFailCounter < 0 { + func handleRetry() { + self.crlFailCounter -= 1 + if self.crlFailCounter < 0 { log("failed too many times") if progress.remainingSize == "0.00" || progress.remainingSize == "" { delegate?.statusDidChange(with: .statusNetworkError) @@ -178,13 +178,14 @@ class CRLSynchronizationManager { } } - func handleStatusRetry(responseCode: Int?){ - self.crlStatusFailCounter -= 1 + func handleStatusRetry(responseCode: Int?) { + if responseCode != 408 { + self.crlStatusFailCounter -= 1 + } if self.crlStatusFailCounter < 0 || !Connectivity.isOnline || responseCode == 408 { self.delegate?.statusDidChange(with: .statusNetworkError) - } - else { + } else { self.cleanAndRetry() } }