Skip to content

Commit

Permalink
request.Request: remove useless function (coredns#2714)
Browse files Browse the repository at this point in the history
ErrorMessage was a very shallow function that didn't add anything.
Remove it and remove its usage.

Signed-off-by: Miek Gieben <miek@miek.nl>
  • Loading branch information
miekg authored Mar 24, 2019
1 parent 1e281ad commit f08f7e2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
3 changes: 2 additions & 1 deletion plugin/forward/forward.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ func (f *Forward) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg
if !state.Match(ret) {
debug.Hexdumpf(ret, "Wrong reply for id: %d, %s %d", ret.Id, state.QName(), state.QType())

formerr := state.ErrorMessage(dns.RcodeFormatError)
formerr := new(dns.Msg)
formerr.SetRcode(state.Req, dns.RcodeFormatError)
w.WriteMsg(formerr)
return 0, taperr
}
Expand Down
3 changes: 2 additions & 1 deletion plugin/grpc/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ func (g *GRPC) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (
if !state.Match(ret) {
debug.Hexdumpf(ret, "Wrong reply for id: %d, %s %d", ret.Id, state.QName(), state.QType())

formerr := state.ErrorMessage(dns.RcodeFormatError)
formerr := new(dns.Msg)
formerr.SetRcode(state.Req, dns.RcodeFormatError)
w.WriteMsg(formerr)
return 0, nil
}
Expand Down
8 changes: 0 additions & 8 deletions request/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,14 +433,6 @@ func (r *Request) QClass() uint16 {

}

// ErrorMessage returns an error message suitable for sending
// back to the client.
func (r *Request) ErrorMessage(rcode int) *dns.Msg {
m := new(dns.Msg)
m.SetRcode(r.Req, rcode)
return m
}

// Clear clears all caching from Request s.
func (r *Request) Clear() {
r.name = ""
Expand Down

0 comments on commit f08f7e2

Please sign in to comment.