From 56ad5f74e9e1867bc5149a7f883cb6248955dc4a Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sat, 22 Dec 2018 07:07:53 +0100 Subject: [PATCH] Also refresh status Signed-off-by: Jason A. Donenfeld --- WireGuard/WireGuard/Tunnel/TunnelsManager.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/WireGuard/WireGuard/Tunnel/TunnelsManager.swift b/WireGuard/WireGuard/Tunnel/TunnelsManager.swift index a2360a8..da1b217 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)'")