Disconnect from Control D without checking pin for app restarts

This commit is contained in:
Ginder Singh
2024-04-10 17:22:05 +00:00
committed by Cuong Manh Le
parent 69ee6582e2
commit 6604f973ac

View File

@@ -61,8 +61,13 @@ func mapCallback(callback AppCallback) cli.AppCallback {
}
}
func (c *Controller) Stop(Pin int64) int {
errorCode := cli.CheckDeactivationPin(Pin, c.stopCh)
func (c *Controller) Stop(restart bool, pin int64) int {
var errorCode = 0
// Force disconnect without checking pin.
// In iOS restart is required if vpn detects no connectivity after network change.
if !restart {
errorCode = cli.CheckDeactivationPin(pin, c.stopCh)
}
if errorCode == 0 && c.stopCh != nil {
close(c.stopCh)
c.stopCh = nil