mirror of
https://github.com/safing/portbase
synced 2025-09-01 10:09:50 +00:00
Fix bug that shouldn't exist
This commit is contained in:
parent
a8e7d0ecc7
commit
2fd7e3fbc7
1 changed files with 8 additions and 4 deletions
|
@ -1,6 +1,7 @@
|
|||
package modules
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/tevino/abool"
|
||||
|
@ -53,6 +54,13 @@ func checkStopStatus() (readyToStop []*Module, done bool) {
|
|||
// Shutdown stops all modules in the correct order.
|
||||
func Shutdown() error {
|
||||
|
||||
if shutdownSignalClosed.SetToIf(false, true) {
|
||||
close(shutdownSignal)
|
||||
} else {
|
||||
// shutdown was already issued
|
||||
return errors.New("shutdown already initiated")
|
||||
}
|
||||
|
||||
if startComplete.IsSet() {
|
||||
log.Warning("modules: starting shutdown...")
|
||||
modulesLock.Lock()
|
||||
|
@ -61,10 +69,6 @@ func Shutdown() error {
|
|||
log.Warning("modules: aborting, shutting down...")
|
||||
}
|
||||
|
||||
if shutdownSignalClosed.SetToIf(false, true) {
|
||||
close(shutdownSignal)
|
||||
}
|
||||
|
||||
reports := make(chan error, 10)
|
||||
for {
|
||||
readyToStop, done := checkStopStatus()
|
||||
|
|
Loading…
Add table
Reference in a new issue