macOS: Deactivate any active tunnel when app exits
Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
parent
76527ef0f8
commit
e5a76be6fd
|
@ -40,6 +40,12 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||||
self.statusItemController = statusItemController
|
self.statusItemController = statusItemController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func applicationWillTerminate(_ notification: Notification) {
|
||||||
|
if let currentTunnel = tunnelsTracker?.currentTunnel {
|
||||||
|
tunnelsManager?.startDeactivation(of: currentTunnel)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension AppDelegate: StatusMenuWindowDelegate {
|
extension AppDelegate: StatusMenuWindowDelegate {
|
||||||
|
|
|
@ -16,7 +16,7 @@ class TunnelsTracker {
|
||||||
|
|
||||||
private var tunnelsManager: TunnelsManager
|
private var tunnelsManager: TunnelsManager
|
||||||
private var tunnelStatusObservers = [AnyObject]()
|
private var tunnelStatusObservers = [AnyObject]()
|
||||||
private var currentTunnel: TunnelContainer? {
|
private(set) var currentTunnel: TunnelContainer? {
|
||||||
didSet {
|
didSet {
|
||||||
statusMenu?.currentTunnel = currentTunnel
|
statusMenu?.currentTunnel = currentTunnel
|
||||||
statusItemController?.currentTunnel = currentTunnel
|
statusItemController?.currentTunnel = currentTunnel
|
||||||
|
|
Loading…
Reference in New Issue