Fix panic where r.Compress would be set before checking for errors.

This commit is contained in:
epipho 2015-06-24 18:58:45 -04:00 committed by James Phillips
parent d965e90306
commit 41db005d0b
No known key found for this signature in database
GPG Key ID: 77183E682AC5FC11
1 changed files with 1 additions and 1 deletions

View File

@ -787,8 +787,8 @@ func (d *DNSServer) handleRecurse(resp dns.ResponseWriter, req *dns.Msg) {
var err error
for _, recursor := range d.recursors {
r, rtt, err = c.Exchange(req, recursor)
r.Compress = true
if err == nil {
r.Compress = true
// Forward the response
d.logger.Printf("[DEBUG] dns: recurse RTT for %v (%v)", q, rtt)
if err := resp.WriteMsg(r); err != nil {