Skip to content

Commit

Permalink
Update doq.go
Browse files Browse the repository at this point in the history
  • Loading branch information
lyekumchew authored and mr-karan committed Jun 20, 2022
1 parent 2008cd9 commit 96e11c0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/resolvers/doq.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ func (r *DOQResolver) Lookup(question dns.Question) (Response, error) {
if err != nil {
return rsp, err
}
// Make a QUIC request to the DNS server with the DNS message as wire format bytes in the body.
_, err = stream.Write(b)
if err != nil {
return rsp, err
Expand All @@ -96,6 +97,8 @@ func (r *DOQResolver) Lookup(question dns.Question) (Response, error) {
}
rtt := time.Since(now)

_ = stream.Close()

packetLen := binary.BigEndian.Uint16(buf[:2])
if packetLen != uint16(len(buf[2:])) {
return rsp, fmt.Errorf("packet length mismatch")
Expand All @@ -122,8 +125,6 @@ func (r *DOQResolver) Lookup(question dns.Question) (Response, error) {
// stop iterating the searchlist.
break
}

_ = stream.Close()
}
return rsp, nil
}

0 comments on commit 96e11c0

Please sign in to comment.