mirror of
https://github.com/safing/portbase
synced 2025-09-04 11:40:23 +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
|
package modules
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/tevino/abool"
|
"github.com/tevino/abool"
|
||||||
|
@ -53,6 +54,13 @@ func checkStopStatus() (readyToStop []*Module, done bool) {
|
||||||
// Shutdown stops all modules in the correct order.
|
// Shutdown stops all modules in the correct order.
|
||||||
func Shutdown() error {
|
func Shutdown() error {
|
||||||
|
|
||||||
|
if shutdownSignalClosed.SetToIf(false, true) {
|
||||||
|
close(shutdownSignal)
|
||||||
|
} else {
|
||||||
|
// shutdown was already issued
|
||||||
|
return errors.New("shutdown already initiated")
|
||||||
|
}
|
||||||
|
|
||||||
if startComplete.IsSet() {
|
if startComplete.IsSet() {
|
||||||
log.Warning("modules: starting shutdown...")
|
log.Warning("modules: starting shutdown...")
|
||||||
modulesLock.Lock()
|
modulesLock.Lock()
|
||||||
|
@ -61,10 +69,6 @@ func Shutdown() error {
|
||||||
log.Warning("modules: aborting, shutting down...")
|
log.Warning("modules: aborting, shutting down...")
|
||||||
}
|
}
|
||||||
|
|
||||||
if shutdownSignalClosed.SetToIf(false, true) {
|
|
||||||
close(shutdownSignal)
|
|
||||||
}
|
|
||||||
|
|
||||||
reports := make(chan error, 10)
|
reports := make(chan error, 10)
|
||||||
for {
|
for {
|
||||||
readyToStop, done := checkStopStatus()
|
readyToStop, done := checkStopStatus()
|
||||||
|
|
Loading…
Add table
Reference in a new issue