summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJon Petersson <jon.petersson@kvadrat.se>2023-03-16 16:55:23 +0100
committerJon Petersson <jon.petersson@kvadrat.se>2023-03-22 11:22:57 +0100
commitcba458456d64ecb9b6ec8c735f7d5103edf0f049 (patch)
treeea8409cc1122387f60304056ae0b03f21b3a79c8
parentabcb52e1a215877e13a6924a2357672acf9f4cf7 (diff)
downloadmullvadvpn-cba458456d64ecb9b6ec8c735f7d5103edf0f049.tar.xz
mullvadvpn-cba458456d64ecb9b6ec8c735f7d5103edf0f049.zip
Cancel all pending network operations when a logout action is triggered
-rw-r--r--ios/MullvadREST/RESTRetryStrategy.swift4
-rw-r--r--ios/MullvadVPN/TunnelManager/TunnelManager.swift6
2 files changed, 8 insertions, 2 deletions
diff --git a/ios/MullvadREST/RESTRetryStrategy.swift b/ios/MullvadREST/RESTRetryStrategy.swift
index a3b4873de1..954a22bde9 100644
--- a/ios/MullvadREST/RESTRetryStrategy.swift
+++ b/ios/MullvadREST/RESTRetryStrategy.swift
@@ -37,9 +37,9 @@ extension REST {
applyJitter: false
)
- /// Startegy configured with 3 retry attempts and exponential backoff.
+ /// Strategy configured with 2 retry attempts and exponential backoff.
public static var `default` = RetryStrategy(
- maxRetryCount: 3,
+ maxRetryCount: 2,
delay: defaultRetryDelay,
applyJitter: true
)
diff --git a/ios/MullvadVPN/TunnelManager/TunnelManager.swift b/ios/MullvadVPN/TunnelManager/TunnelManager.swift
index 34883c9fdc..5a81c0def0 100644
--- a/ios/MullvadVPN/TunnelManager/TunnelManager.swift
+++ b/ios/MullvadVPN/TunnelManager/TunnelManager.swift
@@ -389,6 +389,12 @@ final class TunnelManager: StorePaymentObserver {
MutuallyExclusive(category: OperationCategory.settingsUpdate.category)
)
+ // Unsetting the account (ie. logging out) should cancel all other currently ongoing
+ // activity.
+ if case .unset = action {
+ operationQueue.cancelAllOperations()
+ }
+
operationQueue.addOperation(operation)
}