mirror of
				https://github.com/coredns/coredns.git
				synced 2025-10-30 17:53:21 -04:00 
			
		
		
		
	Export ServeDNSWithContext for use by gRPC server middleware (#577)
This commit is contained in:
		
				
					committed by
					
						 Miek Gieben
						Miek Gieben
					
				
			
			
				
	
			
			
			
						parent
						
							ef315ef3e2
						
					
				
				
					commit
					72bc7e6278
				
			| @@ -155,10 +155,12 @@ func (s *Server) Address() string { return s.Addr } | |||||||
| // defined in the request so that the correct zone | // defined in the request so that the correct zone | ||||||
| // (configuration and middleware stack) will handle the request. | // (configuration and middleware stack) will handle the request. | ||||||
| func (s *Server) ServeDNS(w dns.ResponseWriter, r *dns.Msg) { | func (s *Server) ServeDNS(w dns.ResponseWriter, r *dns.Msg) { | ||||||
| 	s.serveDNSWithContext(context.Background(), w, r) | 	s.ServeDNSWithContext(context.Background(), w, r) | ||||||
| } | } | ||||||
|  |  | ||||||
| func (s *Server) serveDNSWithContext(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) { | // ServeDNSWithContext may be used as an entrypoint for requests that | ||||||
|  | // come from transports that may include a Context (such as gRPC) | ||||||
|  | func (s *Server) ServeDNSWithContext(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) { | ||||||
| 	defer func() { | 	defer func() { | ||||||
| 		// In case the user doesn't enable error middleware, we still | 		// In case the user doesn't enable error middleware, we still | ||||||
| 		// need to make sure that we stay alive up here | 		// need to make sure that we stay alive up here | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user