From 0f790a940131858894e620024df64d0a8b70c8bd Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Sat, 13 Aug 2022 16:44:14 +0200 Subject: [PATCH] Fix leaks when reconnecting from menu LightVPNManager implementation was still disabling/enabling VPN manually instead of using reconnect() atomically, which led to an IP leak in between the two steps. --- Passepartout/App/Mac/Models/DefaultLightVPNManager.swift | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Passepartout/App/Mac/Models/DefaultLightVPNManager.swift b/Passepartout/App/Mac/Models/DefaultLightVPNManager.swift index 75d03db6..bb8e99d3 100644 --- a/Passepartout/App/Mac/Models/DefaultLightVPNManager.swift +++ b/Passepartout/App/Mac/Models/DefaultLightVPNManager.swift @@ -92,11 +92,7 @@ class DefaultLightVPNManager: LightVPNManager { @MainActor func reconnect() { Task { - if isEnabled { - await vpnManager.disable() - try? await Task.sleep(nanoseconds: 2 * NSEC_PER_SEC) - } - try? await vpnManager.connectWithActiveProfile(toServer: nil) + await vpnManager.reconnect() } } }