mirror of
https://github.com/safing/portmaster
synced 2025-04-08 21:19:10 +00:00
[service] Fix starting and stopping of SPN
This commit is contained in:
parent
57f08eccd7
commit
7f0b5ca149
2 changed files with 6 additions and 4 deletions
|
@ -619,7 +619,7 @@ func (i *Instance) shutdown(exitCode int) {
|
|||
|
||||
// Stopping returns whether the instance is shutting down.
|
||||
func (i *Instance) Stopping() bool {
|
||||
return i.ctx.Err() == nil
|
||||
return i.ctx.Err() != nil
|
||||
}
|
||||
|
||||
// Stopped returns a channel that is triggered when the instance has shut down.
|
||||
|
|
|
@ -86,22 +86,24 @@ func start() error {
|
|||
|
||||
enabled := config.GetAsBool("spn/enable", false)
|
||||
if enabled() {
|
||||
log.Info("spn: starting SPN")
|
||||
module.mgr.Go("ensure SPN is started", module.instance.SPNGroup().EnsureStartedWorker)
|
||||
} else {
|
||||
log.Info("spn: stopping SPN")
|
||||
module.mgr.Go("ensure SPN is stopped", module.instance.SPNGroup().EnsureStoppedWorker)
|
||||
}
|
||||
return false, nil
|
||||
})
|
||||
|
||||
// Load tokens from database.
|
||||
loadTokens()
|
||||
|
||||
// Check if we need to enable SPN now.
|
||||
enabled := config.GetAsBool("spn/enable", false)
|
||||
if enabled() {
|
||||
module.mgr.Go("ensure SPN is started", module.instance.SPNGroup().EnsureStartedWorker)
|
||||
}
|
||||
|
||||
// Load tokens from database.
|
||||
loadTokens()
|
||||
|
||||
// Register new task.
|
||||
module.updateAccountWorkerMgr.Delay(1 * time.Minute)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue