aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar John Belamaric <jbelamaric@infoblox.com> 2017-03-08 16:28:26 -0500
committerGravatar Miek Gieben <miek@miek.nl> 2017-03-08 21:28:26 +0000
commit72bc7e627897301dbf223833e1012e5b6ecc5a34 (patch)
tree516eb403b21089815126f72a38724cf039665e4e
parentef315ef3e23c69e853f3cf3b7357fc85ab653a21 (diff)
downloadcoredns-72bc7e627897301dbf223833e1012e5b6ecc5a34.tar.gz
coredns-72bc7e627897301dbf223833e1012e5b6ecc5a34.tar.zst
coredns-72bc7e627897301dbf223833e1012e5b6ecc5a34.zip
Export ServeDNSWithContext for use by gRPC server middleware (#577)
-rw-r--r--core/dnsserver/server.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/core/dnsserver/server.go b/core/dnsserver/server.go
index 386b0edd3..c4e4b89ab 100644
--- a/core/dnsserver/server.go
+++ b/core/dnsserver/server.go
@@ -155,10 +155,12 @@ func (s *Server) Address() string { return s.Addr }
// defined in the request so that the correct zone
// (configuration and middleware stack) will handle the request.
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() {
// In case the user doesn't enable error middleware, we still
// need to make sure that we stay alive up here