Centralize reconnection delay

This commit is contained in:
Davide De Rosa 2020-12-20 19:43:18 +01:00
parent 341e0e3ba8
commit 663cab34c9
2 changed files with 3 additions and 1 deletions

View File

@ -60,6 +60,8 @@ class CoreConfiguration {
static var versionIdentifier: String? static var versionIdentifier: String?
static let logsSensitiveData = false static let logsSensitiveData = false
static var reconnectionDelay = 2.0
} }
extension CustomStringConvertible { extension CustomStringConvertible {

View File

@ -152,7 +152,7 @@ public class OpenVPNProvider: VPNProvider {
} }
if self.status != .disconnected { if self.status != .disconnected {
self.manager?.connection.stopVPNTunnel() self.manager?.connection.stopVPNTunnel()
DispatchQueue.main.asyncAfter(deadline: .now() + 2.0, execute: connectBlock) DispatchQueue.main.asyncAfter(deadline: .now() + CoreConfiguration.reconnectionDelay, execute: connectBlock)
} else { } else {
connectBlock() connectBlock()
} }