blob: 8a0805a19dc8c298cda1a7b703346866fcc8e27b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
package core
import "log"
// Restart restarts CoreDNS forcefully using newCorefile,
// or, if nil, the current/existing Corefile is reused.
func Restart(newCorefile Input) error {
log.Println("[INFO] Restarting")
if newCorefile == nil {
corefileMu.Lock()
newCorefile = corefile
corefileMu.Unlock()
}
wg.Add(1) // barrier so Wait() doesn't unblock
err := Stop()
if err != nil {
return err
}
err = Start(newCorefile)
if err != nil {
return err
}
wg.Done() // take down our barrier
return nil
}
|