From e5a76be6fdf0d1365d6cb8d3f3df517d615d4b3a Mon Sep 17 00:00:00 2001 From: Roopesh Chander Date: Wed, 23 Jan 2019 16:31:26 +0530 Subject: macOS: Deactivate any active tunnel when app exits Signed-off-by: Roopesh Chander --- WireGuard/WireGuard/UI/macOS/AppDelegate.swift | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'WireGuard/WireGuard/UI/macOS/AppDelegate.swift') diff --git a/WireGuard/WireGuard/UI/macOS/AppDelegate.swift b/WireGuard/WireGuard/UI/macOS/AppDelegate.swift index 76ac000..5546eef 100644 --- a/WireGuard/WireGuard/UI/macOS/AppDelegate.swift +++ b/WireGuard/WireGuard/UI/macOS/AppDelegate.swift @@ -40,6 +40,12 @@ class AppDelegate: NSObject, NSApplicationDelegate { self.statusItemController = statusItemController } } + + func applicationWillTerminate(_ notification: Notification) { + if let currentTunnel = tunnelsTracker?.currentTunnel { + tunnelsManager?.startDeactivation(of: currentTunnel) + } + } } extension AppDelegate: StatusMenuWindowDelegate { -- cgit v1.2.3-59-g8ed1b