From 6604f973ac1359893f93bebeb864b8aa4ee66a45 Mon Sep 17 00:00:00 2001 From: Ginder Singh Date: Wed, 10 Apr 2024 17:22:05 +0000 Subject: [PATCH] Disconnect from Control D without checking pin for app restarts --- cmd/ctrld_library/main.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cmd/ctrld_library/main.go b/cmd/ctrld_library/main.go index f1b17d1..49f5b26 100644 --- a/cmd/ctrld_library/main.go +++ b/cmd/ctrld_library/main.go @@ -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