Update doq.go

pull/44/head
AUTUMN 2022-06-14 00:03:36 +08:00 committed by Karan Sharma
parent 2008cd9ed9
commit 96e11c01a7
1 changed files with 3 additions and 2 deletions

View File

@ -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
@ -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")
@ -122,8 +125,6 @@ func (r *DOQResolver) Lookup(question dns.Question) (Response, error) {
// stop iterating the searchlist.
break
}
_ = stream.Close()
}
return rsp, nil
}