Clear VPN error status before restart
This commit is contained in:
parent
e8f2aaaf08
commit
976e47af64
|
@ -286,6 +286,13 @@ class ConnectionService: Codable {
|
|||
return TunnelKitProvider.ProviderError(rawValue: rawValue)
|
||||
}
|
||||
|
||||
func clearVpnLastError() {
|
||||
guard let key = tunnelConfiguration.lastErrorKey else {
|
||||
return
|
||||
}
|
||||
defaults.removeObject(forKey: key)
|
||||
}
|
||||
|
||||
// func eraseVpnLog() {
|
||||
// defaults.removeObject(forKey: Keys.vpnLog)
|
||||
// }
|
||||
|
|
|
@ -58,10 +58,12 @@ class GracefulVPN {
|
|||
func prepare(withProfile profile: ConnectionProfile?, completionHandler: (() -> Void)?) {
|
||||
self.profile = profile
|
||||
log.info("Preparing...")
|
||||
service.clearVpnLastError()
|
||||
vpn?.prepare(completionHandler: completionHandler)
|
||||
}
|
||||
|
||||
func reconnect(completionHandler: ((Error?) -> Void)?) {
|
||||
service.clearVpnLastError()
|
||||
do {
|
||||
log.info("Reconnecting...")
|
||||
try vpn?.reconnect(configuration: service.vpnConfiguration(), completionHandler: completionHandler)
|
||||
|
@ -71,6 +73,7 @@ class GracefulVPN {
|
|||
}
|
||||
|
||||
func reinstall(completionHandler: ((Error?) -> Void)?) {
|
||||
service.clearVpnLastError()
|
||||
do {
|
||||
log.info("Reinstalling...")
|
||||
try vpn?.install(configuration: service.vpnConfiguration(), completionHandler: completionHandler)
|
||||
|
|
Loading…
Reference in New Issue