core: synchronize Stop with concurrent config reloads (#8038)
Signed-off-by: hendrixx-cnc <tjhendrx@icloud.com>
This commit is contained in:
parent
df77f8bde1
commit
128b9e75e0
1 changed files with 4 additions and 6 deletions
10
caddy.go
10
caddy.go
|
|
@ -692,21 +692,19 @@ type ConfigLoader interface {
|
|||
// stop the others. Stop should only be called
|
||||
// if not replacing with a new config.
|
||||
func Stop() error {
|
||||
currentCtxMu.RLock()
|
||||
ctx := currentCtx
|
||||
currentCtxMu.RUnlock()
|
||||
|
||||
rawCfgMu.Lock()
|
||||
unsyncedStop(ctx)
|
||||
defer rawCfgMu.Unlock()
|
||||
|
||||
currentCtxMu.Lock()
|
||||
ctx := currentCtx
|
||||
currentCtx = Context{}
|
||||
currentCtxMu.Unlock()
|
||||
|
||||
unsyncedStop(ctx)
|
||||
|
||||
rawCfgJSON = nil
|
||||
rawCfgIndex = nil
|
||||
rawCfg[rawConfigKey] = nil
|
||||
rawCfgMu.Unlock()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue