@eskimo
Yes, I send a message in the APP to ask the tunnel to restart the internal service, not the entire extension process. The benefit of this is that reconnection takes less time and is simpler.
I mainly handle restarting the service in handleAppMessage():
Clear current configuration through setTunnelNetworkSettings(nil)
Call setTunnelNetworkSettings(settings) for configuration
In fact, I don't want to call setTunnelNetworkSettings before restarting the service, but I can't clear the DNS cache data without doing this, so I have to do this.
handleAppMessage looks more like:
open override func handleAppMessage(_ messageData: Data, completionHandler: ((Data?) -> Void)?) {
reasserting = true
setTunnelNetworkSettings(nil) { error in
// settings = ....
setTunnelNetworkSettings(settings) {
reasserting = false
proxy.restart()
completionHandler("ok"...)
}
}
}
I suspect there is a memory error inside setTunnelNetworkSettings(...) that causes completionHandler("ok"...) to fail occasionally
things would be simpler if NEVPNConnection provided restartVPNTunnel().
Topic:
App & System Services
SubTopic:
Core OS
Tags: