summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--ios/MullvadVPN/AppDelegate.swift7
-rw-r--r--ios/MullvadVPN/SimulatorTunnelProviderHost.swift7
2 files changed, 11 insertions, 3 deletions
diff --git a/ios/MullvadVPN/AppDelegate.swift b/ios/MullvadVPN/AppDelegate.swift
index 75f41f0fb2..e52c680b05 100644
--- a/ios/MullvadVPN/AppDelegate.swift
+++ b/ios/MullvadVPN/AppDelegate.swift
@@ -21,7 +21,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
private var logger: Logger!
#if targetEnvironment(simulator)
- private let simulatorTunnelProvider = SimulatorTunnelProviderHost()
+ private var simulatorTunnelProviderHost: SimulatorTunnelProviderHost?
#endif
private let operationQueue: AsyncOperationQueue = {
@@ -47,7 +47,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
#if targetEnvironment(simulator)
// Configure mock tunnel provider on simulator
- SimulatorTunnelProvider.shared.delegate = simulatorTunnelProvider
+ simulatorTunnelProviderHost = SimulatorTunnelProviderHost(
+ relayCacheTracker: .shared
+ )
+ SimulatorTunnelProvider.shared.delegate = simulatorTunnelProviderHost
#endif
registerBackgroundTasks()
diff --git a/ios/MullvadVPN/SimulatorTunnelProviderHost.swift b/ios/MullvadVPN/SimulatorTunnelProviderHost.swift
index 688a6af3bc..6068036cfe 100644
--- a/ios/MullvadVPN/SimulatorTunnelProviderHost.swift
+++ b/ios/MullvadVPN/SimulatorTunnelProviderHost.swift
@@ -21,10 +21,15 @@ class SimulatorTunnelProviderHost: SimulatorTunnelProviderDelegate {
private var selectorResult: RelaySelectorResult?
private let urlSession = REST.makeURLSession()
private var proxiedRequests = [UUID: URLSessionDataTask]()
+ private let relayCacheTracker: RelayCacheTracker
private let providerLogger = Logger(label: "SimulatorTunnelProviderHost")
private let dispatchQueue = DispatchQueue(label: "SimulatorTunnelProviderHostQueue")
+ init(relayCacheTracker: RelayCacheTracker) {
+ self.relayCacheTracker = relayCacheTracker
+ }
+
override func startTunnel(
options: [String: NSObject]?,
completionHandler: @escaping (Error?) -> Void
@@ -158,7 +163,7 @@ class SimulatorTunnelProviderHost: SimulatorTunnelProviderDelegate {
}
private func pickRelay() throws -> RelaySelectorResult {
- let cachedRelays = try RelayCacheTracker.shared.getCachedRelays()
+ let cachedRelays = try relayCacheTracker.getCachedRelays()
let tunnelSettings = try SettingsManager.readSettings()
return try RelaySelector.evaluate(