TunnelsManager: Don't restart if only on-demand setting has changed
This commit is contained in:
parent
9c71d63254
commit
ce291d54a1
|
@ -184,7 +184,11 @@ class TunnelsManager {
|
||||||
tunnel.name = tunnelName
|
tunnel.name = tunnelName
|
||||||
}
|
}
|
||||||
|
|
||||||
tunnelProviderManager.setTunnelConfiguration(tunnelConfiguration)
|
var isTunnelConfigurationChanged = false
|
||||||
|
if tunnelProviderManager.tunnelConfiguration != tunnelConfiguration {
|
||||||
|
tunnelProviderManager.setTunnelConfiguration(tunnelConfiguration)
|
||||||
|
isTunnelConfigurationChanged = true
|
||||||
|
}
|
||||||
tunnelProviderManager.isEnabled = true
|
tunnelProviderManager.isEnabled = true
|
||||||
|
|
||||||
let isActivatingOnDemand = !tunnelProviderManager.isOnDemandEnabled && activateOnDemandSetting.isActivateOnDemandEnabled
|
let isActivatingOnDemand = !tunnelProviderManager.isOnDemandEnabled && activateOnDemandSetting.isActivateOnDemandEnabled
|
||||||
|
@ -206,10 +210,12 @@ class TunnelsManager {
|
||||||
}
|
}
|
||||||
self.tunnelsListDelegate?.tunnelModified(at: self.tunnels.firstIndex(of: tunnel)!)
|
self.tunnelsListDelegate?.tunnelModified(at: self.tunnels.firstIndex(of: tunnel)!)
|
||||||
|
|
||||||
if tunnel.status == .active || tunnel.status == .activating || tunnel.status == .reasserting {
|
if isTunnelConfigurationChanged {
|
||||||
// Turn off the tunnel, and then turn it back on, so the changes are made effective
|
if tunnel.status == .active || tunnel.status == .activating || tunnel.status == .reasserting {
|
||||||
tunnel.status = .restarting
|
// Turn off the tunnel, and then turn it back on, so the changes are made effective
|
||||||
(tunnel.tunnelProvider.connection as? NETunnelProviderSession)?.stopTunnel()
|
tunnel.status = .restarting
|
||||||
|
(tunnel.tunnelProvider.connection as? NETunnelProviderSession)?.stopTunnel()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if isActivatingOnDemand {
|
if isActivatingOnDemand {
|
||||||
|
|
Loading…
Reference in New Issue