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.
This commit is contained in:
Davide De Rosa 2022-08-13 16:44:14 +02:00
parent 7a700408a8
commit 0f790a9401
1 changed files with 1 additions and 5 deletions

View File

@ -92,11 +92,7 @@ class DefaultLightVPNManager: LightVPNManager {
@MainActor @MainActor
func reconnect() { func reconnect() {
Task { Task {
if isEnabled { await vpnManager.reconnect()
await vpnManager.disable()
try? await Task.sleep(nanoseconds: 2 * NSEC_PER_SEC)
}
try? await vpnManager.connectWithActiveProfile(toServer: nil)
} }
} }
} }