Close http3 roundtripper when error occurred

For http3, if the network were down, the quic transport needs to be
closed, so the transport can create new connection when network up.
This commit is contained in:
Cuong Manh Le
2022-12-21 00:10:14 +07:00
committed by Cuong Manh Le
parent a6b3c4a757
commit fa3c3e8a29

3
doh.go
View File

@@ -48,6 +48,9 @@ func (r *dohResolver) Resolve(ctx context.Context, msg *dns.Msg) (*dns.Msg, erro
}
resp, err := c.Do(req)
if err != nil {
if r.isDoH3 {
r.http3RoundTripper.Close()
}
return nil, fmt.Errorf("could not perform request: %w", err)
}
defer resp.Body.Close()