aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/VPN/TunnelsManager.swift
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2018-12-10 17:00:31 +0530
committerRoopesh Chander <roop@roopc.net>2018-12-10 17:01:53 +0530
commit0d7a585bf7cc53c7cbe34847dc6ffaf6ae9b692e (patch)
tree707600b9649be29d818de64576f1e8efbca2f4f4 /WireGuard/WireGuard/VPN/TunnelsManager.swift
parentTunnelsManager: Debugging helpers for tunnel status (diff)
downloadwireguard-apple-0d7a585bf7cc53c7cbe34847dc6ffaf6ae9b692e.tar.xz
wireguard-apple-0d7a585bf7cc53c7cbe34847dc6ffaf6ae9b692e.zip
TunnelsManager: Always call the completion handler before returning
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to '')
-rw-r--r--WireGuard/WireGuard/VPN/TunnelsManager.swift4
1 files changed, 4 insertions, 0 deletions
diff --git a/WireGuard/WireGuard/VPN/TunnelsManager.swift b/WireGuard/WireGuard/VPN/TunnelsManager.swift
index c8c2b2a..d3f711a 100644
--- a/WireGuard/WireGuard/VPN/TunnelsManager.swift
+++ b/WireGuard/WireGuard/VPN/TunnelsManager.swift
@@ -26,6 +26,7 @@ enum TunnelsManagerError: WireGuardAppError {
case vpnSystemErrorOnRemoveTunnel
// Tunnel activation
+ case attemptingActivationWhenTunnelIsNotInactive
case tunnelActivationAttemptFailed // startTunnel() throwed
case tunnelActivationFailedInternalError // startTunnel() succeeded, but activation failed
case tunnelActivationFailedNoInternetConnection // startTunnel() succeeded, but activation failed since no internet
@@ -45,6 +46,8 @@ enum TunnelsManagerError: WireGuardAppError {
case .vpnSystemErrorOnRemoveTunnel:
return ("Unable to remove tunnel", "Internal error")
+ case .attemptingActivationWhenTunnelIsNotInactive:
+ return ("Activation failure", "The tunnel is already active or in the process of being activated")
case .tunnelActivationAttemptFailed:
return ("Activation failure", "The tunnel could not be activated due to an internal error")
case .tunnelActivationFailedInternalError:
@@ -232,6 +235,7 @@ class TunnelsManager {
func startActivation(of tunnel: TunnelContainer, completionHandler: @escaping (TunnelsManagerError?) -> Void) {
guard (tunnel.status == .inactive) else {
+ completionHandler(TunnelsManagerError.attemptingActivationWhenTunnelIsNotInactive)
return
}