If the selected tunnel is not "enabled", make it enabled.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
a95212fcc8
commit
603953a8b8
|
@ -166,11 +166,20 @@ extension AppCoordinator: TunnelsTableViewControllerDelegate {
|
||||||
// Should the manager be enabled?
|
// Should the manager be enabled?
|
||||||
|
|
||||||
let manager = providerManager(for: tunnel)
|
let manager = providerManager(for: tunnel)
|
||||||
let session = manager?.connection as! NETunnelProviderSession //swiftlint:disable:this force_cast
|
manager?.isEnabled = true
|
||||||
do {
|
manager?.saveToPreferences { (error) in
|
||||||
try session.startTunnel()
|
if let error = error {
|
||||||
} catch let error {
|
os_log("error saving preferences: %{public}@", log: Log.general, type: .error, error.localizedDescription)
|
||||||
os_log("error starting tunnel: %{public}@", log: Log.general, type: .error, error.localizedDescription)
|
return
|
||||||
|
}
|
||||||
|
os_log("saved preferences", log: Log.general, type: .info)
|
||||||
|
|
||||||
|
let session = manager?.connection as! NETunnelProviderSession //swiftlint:disable:this force_cast
|
||||||
|
do {
|
||||||
|
try session.startTunnel()
|
||||||
|
} catch let error {
|
||||||
|
os_log("error starting tunnel: %{public}@", log: Log.general, type: .error, error.localizedDescription)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue