From: Roopesh Chander Date: Sat, 3 Nov 2018 13:33:27 +0000 (+0530) Subject: VPN: Start observing the status only if startTunnel() succeeds X-Git-Tag: 0.0.20181104-1~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=582092abb1edb766dc42620ec90cd1f18d7cc01e;p=thirdparty%2Fwireguard-apple.git 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 --- diff --git a/WireGuard/WireGuard/VPN/TunnelsManager.swift b/WireGuard/WireGuard/VPN/TunnelsManager.swift index a36d5d0..05388cd 100644 --- a/WireGuard/WireGuard/VPN/TunnelsManager.swift +++ b/WireGuard/WireGuard/VPN/TunnelsManager.swift @@ -341,7 +341,6 @@ class TunnelContainer: NSObject { } // Start the tunnel - startObservingTunnelStatus() let session = (tunnelProvider.connection as! NETunnelProviderSession) do { 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) try session.startTunnel(options: tunnelOptions) os_log("startActivation: Success", log: OSLog.default, type: .debug) + startObservingTunnelStatus() completionHandler(nil) } catch (let error) { os_log("startActivation: Error starting tunnel. Examining error", log: OSLog.default, type: .debug)