Skip to content

Commit

Permalink
Merge pull request #345 from ivpn/bugfix/app-remains-in-disconnecting…
Browse files Browse the repository at this point in the history
…-state

App remains on "disconnecting" state
  • Loading branch information
jurajhilje authored May 17, 2023
2 parents 51238f7 + 2d856e8 commit 2bcfcd3
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions IVPNClient/Managers/VPNManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -240,13 +240,17 @@ class VPNManager {
case .openvpn:
self.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
self.disconnect(tunnelType: .openvpn)
}
}
}
case .wireguard:
self.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
self.disconnect(tunnelType: .wireguard)
}
}
}
}
Expand All @@ -265,7 +269,9 @@ class VPNManager {

func disconnect(tunnelType: TunnelType, reconnectAutomatically: Bool = false) {
getManagerFor(tunnelType: tunnelType) { manager in
manager.connection.stopVPNTunnel()
DispatchQueue.async {
manager.connection.stopVPNTunnel()
}

if !UserDefaults.shared.networkProtectionEnabled || reconnectAutomatically {
self.removeOnDemandRule(manager: manager)
Expand Down

0 comments on commit 2bcfcd3

Please sign in to comment.