aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/Tunnel
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-12-22 06:56:12 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2018-12-22 06:56:12 +0100
commit49bf55021fa3f66c1a1e520c0b37d0bd5e84bc1d (patch)
tree94ed5560a0f98a5e73a1c253ae3d22672e0019f2 /WireGuard/WireGuard/Tunnel
parentAll models now Equatable (diff)
downloadwireguard-apple-49bf55021fa3f66c1a1e520c0b37d0bd5e84bc1d.tar.xz
wireguard-apple-49bf55021fa3f66c1a1e520c0b37d0bd5e84bc1d.zip
Reassign tunnelProvider if it changes from outside the app
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'WireGuard/WireGuard/Tunnel')
-rw-r--r--WireGuard/WireGuard/Tunnel/TunnelsManager.swift6
1 files changed, 4 insertions, 2 deletions
diff --git a/WireGuard/WireGuard/Tunnel/TunnelsManager.swift b/WireGuard/WireGuard/Tunnel/TunnelsManager.swift
index 8b5311da..a2360a88 100644
--- a/WireGuard/WireGuard/Tunnel/TunnelsManager.swift
+++ b/WireGuard/WireGuard/Tunnel/TunnelsManager.swift
@@ -281,7 +281,9 @@ class TunnelsManager {
guard let self = self,
let session = statusChangeNotification.object as? NETunnelProviderSession,
let tunnelProvider = session.manager as? NETunnelProviderManager,
- let tunnel = self.tunnels.first(where: { $0.tunnelProvider == tunnelProvider }) else { return }
+ let tunnelConfiguration = TunnelContainer(tunnel: tunnelProvider).tunnelConfiguration,
+ let tunnel = self.tunnels.first(where: { $0.tunnelConfiguration == tunnelConfiguration }) else { return }
+ tunnel.tunnelProvider = tunnelProvider
wg_log(.debug, message: "Tunnel '\(tunnel.name)' connection status changed to '\(tunnel.tunnelProvider.connection.status)'")
@@ -364,7 +366,7 @@ class TunnelContainer: NSObject {
var activationAttemptId: String?
var activationTimer: Timer?
- fileprivate let tunnelProvider: NETunnelProviderManager
+ fileprivate var tunnelProvider: NETunnelProviderManager
private var lastTunnelConnectionStatus: NEVPNStatus?
var tunnelConfiguration: TunnelConfiguration? {