Fix restarting flag for direct restarts

This commit is contained in:
Daniel
2021-10-19 11:48:17 +02:00
parent 003f99e392
commit 8c57baa12a
3 changed files with 11 additions and 6 deletions

View File

@@ -68,8 +68,6 @@ func shutdown(_ *api.Request) (msg string, err error) {
func restart(_ *api.Request) (msg string, err error) {
log.Info("core: user requested restart via action")
// Trigger restart event instead of shutdown event.
restarting.Set()
// Let the updates module handle restarting.
updates.RestartNow()

View File

@@ -7,13 +7,12 @@ import (
"github.com/safing/portbase/modules"
"github.com/safing/portbase/modules/subsystems"
"github.com/tevino/abool"
"github.com/safing/portmaster/updates"
// module dependencies
_ "github.com/safing/portmaster/netenv"
_ "github.com/safing/portmaster/status"
_ "github.com/safing/portmaster/ui"
_ "github.com/safing/portmaster/updates"
)
const (
@@ -24,7 +23,6 @@ const (
var (
module *modules.Module
restarting = abool.New()
disableShutdownEvent bool
)
@@ -82,7 +80,7 @@ func registerEvents() {
func shutdownHook() {
// Notify everyone of the restart/shutdown.
if restarting.IsNotSet() {
if !updates.IsRestarting() {
// Only trigger shutdown event if not disabled.
if !disableShutdownEvent {
module.TriggerEvent(eventShutdown, nil)