Skip to content

Commit

Permalink
Merge branch 'bugfix/network-protection-ios17' into staging-2.11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jurajhilje committed Oct 18, 2023
2 parents aa97036 + 8478edd commit 1766d10
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions IVPNClient/Managers/VPNManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -242,13 +242,21 @@ class VPNManager {
case .openvpn:
disable(tunnelType: .ipsec) { _ in
self.disable(tunnelType: .wireguard) { _ in
self.setup(settings: settings, accessDetails: accessDetails, status: .disconnected) { _ in }
self.setup(settings: settings, accessDetails: accessDetails, status: .disconnected) { _ in
DispatchQueue.async {
self.openvpnManager?.connection.stopVPNTunnel()
}
}
}
}
case .wireguard:
disable(tunnelType: .ipsec) { _ in
self.disable(tunnelType: .openvpn) { _ in
self.setup(settings: settings, accessDetails: accessDetails, status: .disconnected) { _ in }
self.setup(settings: settings, accessDetails: accessDetails, status: .disconnected) { _ in
DispatchQueue.async {
self.wireguardManager?.connection.stopVPNTunnel()
}
}
}
}
}
Expand All @@ -270,7 +278,10 @@ class VPNManager {
func disconnect(tunnelType: TunnelType, reconnectAutomatically: Bool = false) {
getManagerFor(tunnelType: tunnelType) { [self] manager in
manager.connection.stopVPNTunnel()
removeOnDemandRule(manager: manager)

if !UserDefaults.shared.networkProtectionEnabled || reconnectAutomatically {
removeOnDemandRule(manager: manager)
}
}
}

Expand Down

0 comments on commit 1766d10

Please sign in to comment.