mirror of
				https://github.com/coredns/coredns.git
				synced 2025-10-30 17:53:21 -04:00 
			
		
		
		
	Call wg.Add in main goroutine to avoid race conditons. (#3433)
Signed-off-by: Guangming Wang <guangming.wang@daocloud.io>
This commit is contained in:
		
				
					committed by
					
						 Miek Gieben
						Miek Gieben
					
				
			
			
				
	
			
			
			
						parent
						
							1942746c48
						
					
				
				
					commit
					113783ed91
				
			| @@ -109,8 +109,8 @@ func (t Transfer) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg | |||||||
| 	ch := make(chan *dns.Envelope) | 	ch := make(chan *dns.Envelope) | ||||||
| 	tr := new(dns.Transfer) | 	tr := new(dns.Transfer) | ||||||
| 	wg := new(sync.WaitGroup) | 	wg := new(sync.WaitGroup) | ||||||
|  | 	wg.Add(1) | ||||||
| 	go func() { | 	go func() { | ||||||
| 		wg.Add(1) |  | ||||||
| 		tr.Out(w, r, ch) | 		tr.Out(w, r, ch) | ||||||
| 		wg.Done() | 		wg.Done() | ||||||
| 	}() | 	}() | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user