diff options
Diffstat (limited to 'pkg/backend')
-rw-r--r-- | pkg/backend/api.go | 2 | ||||
-rw-r--r-- | pkg/backend/init.go | 8 |
2 files changed, 10 insertions, 0 deletions
diff --git a/pkg/backend/api.go b/pkg/backend/api.go index ea148f7..9706bdf 100644 --- a/pkg/backend/api.go +++ b/pkg/backend/api.go @@ -11,6 +11,7 @@ import ( "0xacab.org/leap/bitmask-vpn/pkg/bitmask" "0xacab.org/leap/bitmask-vpn/pkg/config/version" + "0xacab.org/leap/bitmask-vpn/pkg/pid" "0xacab.org/leap/bitmask-vpn/pkg/pickle" ) @@ -56,6 +57,7 @@ func Quit() { if ctx.bm != nil { ctx.bm.Close() } + pid.ReleasePID() } func DonateAccepted() { diff --git a/pkg/backend/init.go b/pkg/backend/init.go index aabc720..c0d8f37 100644 --- a/pkg/backend/init.go +++ b/pkg/backend/init.go @@ -7,6 +7,7 @@ import ( "0xacab.org/leap/bitmask-vpn/pkg/bitmask" "0xacab.org/leap/bitmask-vpn/pkg/config" "0xacab.org/leap/bitmask-vpn/pkg/config/version" + "0xacab.org/leap/bitmask-vpn/pkg/pid" ) // initializeContext initializes an empty connStatus and assigns it to the @@ -52,6 +53,13 @@ func initializeBitmask(errCh chan string, opts *InitOpts) { bitmask.InitializeLogger() ctx.cfg = config.ParseConfig() + err := pid.AcquirePID() + if err != nil { + log.Println("Error acquiring PID:", err) + errCh <- err.Error() + return + } + b, err := bitmask.InitializeBitmask(opts.SkipLaunch) if err != nil { log.Println("error: cannot initialize bitmask") |