aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/VPN
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2018-10-30 00:24:50 +0530
committerRoopesh Chander <roop@roopc.net>2018-10-30 00:24:50 +0530
commit38e4e274aa402788ce89294aece498a2c742f231 (patch)
tree480e94191d81bfbdb5c73ec5a7d1b287bcf0cf58 /WireGuard/WireGuard/VPN
parentVPN: Specify an error when there are no peers with an endpoint (diff)
downloadwireguard-apple-38e4e274aa402788ce89294aece498a2c742f231.tar.xz
wireguard-apple-38e4e274aa402788ce89294aece498a2c742f231.zip
VPN: Better error messages
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to 'WireGuard/WireGuard/VPN')
-rw-r--r--WireGuard/WireGuard/VPN/TunnelsManager.swift7
1 files changed, 6 insertions, 1 deletions
diff --git a/WireGuard/WireGuard/VPN/TunnelsManager.swift b/WireGuard/WireGuard/VPN/TunnelsManager.swift
index 6559382..749b83d 100644
--- a/WireGuard/WireGuard/VPN/TunnelsManager.swift
+++ b/WireGuard/WireGuard/VPN/TunnelsManager.swift
@@ -265,6 +265,7 @@ class TunnelContainer: NSObject {
if let endpoints = dnsResolver.resolveWithoutNetworkRequests() {
guard (endpoints.contains(where: { $0 != nil })) else {
completionHandler(TunnelsManagerError.noEndpoint)
+ status = .inactive
return
}
self.tunnelProvider.loadFromPreferences { [weak self] (error) in
@@ -278,7 +279,10 @@ class TunnelContainer: NSObject {
} catch (let error) {
os_log("Failed to activate tunnel: %{public}@", log: OSLog.default, type: .debug, "\(error)")
completionHandler(error)
+ s.status = .inactive
+ return
}
+ completionHandler(nil)
}
} else {
self.dnsResolver = dnsResolver
@@ -302,7 +306,8 @@ class TunnelContainer: NSObject {
try session.startTunnel(options: tunnelOptions)
} catch (let error) {
os_log("Failed to activate tunnel: %{public}@", log: OSLog.default, type: .debug, "\(error)")
- completionHandler(error)
+ s.status = .inactive
+ return
}
}
}