aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/Tunnel
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-12-22 07:07:53 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2018-12-22 07:07:53 +0100
commit56ad5f74e9e1867bc5149a7f883cb6248955dc4a (patch)
treef271de5c84fc5ee5626a387264214997f2e17335 /WireGuard/WireGuard/Tunnel
parentReassign tunnelProvider if it changes from outside the app (diff)
downloadwireguard-apple-56ad5f74e9e1867bc5149a7f883cb6248955dc4a.tar.xz
wireguard-apple-56ad5f74e9e1867bc5149a7f883cb6248955dc4a.zip
Also refresh status
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'WireGuard/WireGuard/Tunnel')
-rw-r--r--WireGuard/WireGuard/Tunnel/TunnelsManager.swift5
1 files changed, 4 insertions, 1 deletions
diff --git a/WireGuard/WireGuard/Tunnel/TunnelsManager.swift b/WireGuard/WireGuard/Tunnel/TunnelsManager.swift
index a2360a88..da1b217c 100644
--- a/WireGuard/WireGuard/Tunnel/TunnelsManager.swift
+++ b/WireGuard/WireGuard/Tunnel/TunnelsManager.swift
@@ -283,7 +283,10 @@ class TunnelsManager {
let tunnelProvider = session.manager as? NETunnelProviderManager,
let tunnelConfiguration = TunnelContainer(tunnel: tunnelProvider).tunnelConfiguration,
let tunnel = self.tunnels.first(where: { $0.tunnelConfiguration == tunnelConfiguration }) else { return }
- tunnel.tunnelProvider = tunnelProvider
+ if tunnel.tunnelProvider != tunnelProvider {
+ tunnel.tunnelProvider = tunnelProvider
+ tunnel.refreshStatus()
+ }
wg_log(.debug, message: "Tunnel '\(tunnel.name)' connection status changed to '\(tunnel.tunnelProvider.connection.status)'")