TunnelsManager: startActivation() need not take a tunnelConfiguration

This commit is contained in:
Roopesh Chander 2018-12-14 00:01:41 +05:30
parent b40bbd1cdc
commit 206de837d1
1 changed files with 3 additions and 11 deletions

View File

@ -362,16 +362,8 @@ class TunnelContainer: NSObject {
self.isActivateOnDemandEnabled = self.tunnelProvider.isOnDemandEnabled
}
fileprivate func startActivation(activationDelegate: TunnelsManagerActivationDelegate?) {
assert(status == .inactive || status == .restarting || status == .waiting)
guard let tunnelConfiguration = tunnelConfiguration() else { fatalError() }
startActivation(tunnelConfiguration: tunnelConfiguration, activationDelegate: activationDelegate)
}
//swiftlint:disable:next function_body_length
fileprivate func startActivation(recursionCount: UInt = 0, lastError: Error? = nil, tunnelConfiguration: TunnelConfiguration, activationDelegate: TunnelsManagerActivationDelegate?) {
fileprivate func startActivation(recursionCount: UInt = 0, lastError: Error? = nil, activationDelegate: TunnelsManagerActivationDelegate?) {
if recursionCount >= 8 {
wg_log(.error, message: "startActivation: Failed after 8 attempts. Giving up with \(lastError!)")
activationDelegate?.tunnelActivationAttemptFailed(tunnel: self, error: .failedBecauseOfTooManyErrors)
@ -397,7 +389,7 @@ class TunnelContainer: NSObject {
wg_log(.debug, staticMessage: "startActivation: Tunnel saved after re-enabling")
wg_log(.debug, staticMessage: "startActivation: Invoking startActivation")
self.startActivation(recursionCount: recursionCount + 1, lastError: NEVPNError(NEVPNError.configurationUnknown),
tunnelConfiguration: tunnelConfiguration, activationDelegate: activationDelegate)
activationDelegate: activationDelegate)
}
return
}
@ -434,7 +426,7 @@ class TunnelContainer: NSObject {
}
wg_log(.debug, staticMessage: "startActivation: Tunnel reloaded")
wg_log(.debug, staticMessage: "startActivation: Invoking startActivation")
self.startActivation(recursionCount: recursionCount + 1, lastError: systemError, tunnelConfiguration: tunnelConfiguration, activationDelegate: activationDelegate)
self.startActivation(recursionCount: recursionCount + 1, lastError: systemError, activationDelegate: activationDelegate)
}
}
}