Fix disconnection handler not called when inactive

Fixes #42
This commit is contained in:
Davide De Rosa 2019-03-19 17:20:03 +01:00
parent f5afe5a9ce
commit 9a67918dc0
1 changed files with 8 additions and 4 deletions

View File

@ -120,10 +120,14 @@ public class StandardVPNProvider: VPNProvider {
}
public func disconnect(completionHandler: ((Error?) -> Void)?) {
manager?.connection.stopVPNTunnel()
manager?.isOnDemandEnabled = false
manager?.isEnabled = false
manager?.saveToPreferences(completionHandler: completionHandler)
guard let manager = manager else {
completionHandler?(nil)
return
}
manager.connection.stopVPNTunnel()
manager.isOnDemandEnabled = false
manager.isEnabled = false
manager.saveToPreferences(completionHandler: completionHandler)
}
public func reconnect(configuration: VPNConfiguration, completionHandler: ((Error?) -> Void)?) {