aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/Tunnel
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2019-01-24 18:11:26 +0530
committerRoopesh Chander <roop@roopc.net>2019-01-24 18:11:26 +0530
commit3c8049027301004705e088b1aba1a759aed19d32 (patch)
tree06f5c992e41efce19c729fa80a9b6d6a0763bb00 /WireGuard/WireGuard/Tunnel
parentmacOS: Ensure status is up-to-date on startup (diff)
downloadwireguard-apple-3c8049027301004705e088b1aba1a759aed19d32.tar.xz
wireguard-apple-3c8049027301004705e088b1aba1a759aed19d32.zip
TunnelsManager: func tunnelInOperation()
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to 'WireGuard/WireGuard/Tunnel')
-rw-r--r--WireGuard/WireGuard/Tunnel/TunnelsManager.swift7
1 files changed, 7 insertions, 0 deletions
diff --git a/WireGuard/WireGuard/Tunnel/TunnelsManager.swift b/WireGuard/WireGuard/Tunnel/TunnelsManager.swift
index 5e6ad5c..d65814b 100644
--- a/WireGuard/WireGuard/Tunnel/TunnelsManager.swift
+++ b/WireGuard/WireGuard/Tunnel/TunnelsManager.swift
@@ -234,6 +234,13 @@ class TunnelsManager {
return tunnels.first { $0.status == .waiting }
}
+ func tunnelInOperation() -> TunnelContainer? {
+ if let waitingTunnelObject = waitingTunnel() {
+ return waitingTunnelObject
+ }
+ return tunnels.first { $0.status != .inactive }
+ }
+
func startActivation(of tunnel: TunnelContainer) {
guard tunnels.contains(tunnel) else { return } // Ensure it's not deleted
guard tunnel.status == .inactive else {