VPN: Start observing the status only if startTunnel() succeeds

This should fix the status change to .disconnected when we're resolving endpoints

Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
Roopesh Chander 2018-11-03 19:03:27 +05:30
parent 7c4992894b
commit 582092abb1
1 changed files with 1 additions and 1 deletions

View File

@ -341,7 +341,6 @@ class TunnelContainer: NSObject {
} }
// Start the tunnel // Start the tunnel
startObservingTunnelStatus()
let session = (tunnelProvider.connection as! NETunnelProviderSession) let session = (tunnelProvider.connection as! NETunnelProviderSession)
do { do {
os_log("startActivation: Generating options", log: OSLog.default, type: .debug) os_log("startActivation: Generating options", log: OSLog.default, type: .debug)
@ -350,6 +349,7 @@ class TunnelContainer: NSObject {
os_log("startActivation: Starting tunnel", log: OSLog.default, type: .debug) os_log("startActivation: Starting tunnel", log: OSLog.default, type: .debug)
try session.startTunnel(options: tunnelOptions) try session.startTunnel(options: tunnelOptions)
os_log("startActivation: Success", log: OSLog.default, type: .debug) os_log("startActivation: Success", log: OSLog.default, type: .debug)
startObservingTunnelStatus()
completionHandler(nil) completionHandler(nil)
} catch (let error) { } catch (let error) {
os_log("startActivation: Error starting tunnel. Examining error", log: OSLog.default, type: .debug) os_log("startActivation: Error starting tunnel. Examining error", log: OSLog.default, type: .debug)