Skip to content
This repository has been archived by the owner on Mar 29, 2024. It is now read-only.

Commit

Permalink
Reset failing hubs when the network changes while not connected
Browse files Browse the repository at this point in the history
  • Loading branch information
dhaavi committed Sep 21, 2023
1 parent 997bf67 commit 1c49094
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions captain/module.go
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/safing/portmaster/network/netutils"
"github.com/safing/spn/conf"
"github.com/safing/spn/crew"
"github.com/safing/spn/navigator"
"github.com/safing/spn/patrol"
"github.com/safing/spn/ships"
_ "github.com/safing/spn/sluice"
Expand Down Expand Up @@ -162,6 +163,21 @@ func start() error {
// client + home hub manager
if conf.Client() {
module.StartServiceWorker("client manager", 0, clientManager)

// Reset failing hubs when the network changes while not connected.
if err := module.RegisterEventHook(
"netenv",
"network changed",
"reset failing hubs",
func(_ context.Context, _ interface{}) error {
if ready.IsNotSet() {
navigator.Main.ResetFailingStates(module.Ctx)
}
return nil
},
); err != nil {
return err
}
}

return nil
Expand Down

0 comments on commit 1c49094

Please sign in to comment.