mirror of
				https://github.com/coredns/coredns.git
				synced 2025-10-31 10:13:14 -04:00 
			
		
		
		
	* Changed reference to Caddy over to CoreDNS * Removing references to caddy * Fixed misleading error message to reference coredns * Cleaning up references to caddy * Adding clean and deps targets Muscle memory is resulting in "make clean" commands. * Adding test target to makefile * More "Caddy" cleanup
		
			
				
	
	
		
			32 lines
		
	
	
		
			522 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			522 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| 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
 | |
| }
 |