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 authored and Cuong Manh Le committed 2023-01-20 21:32:55 +07:00
1 parent a6b3c4a757
commit fa3c3e8a29
1 file changed
+3
+3
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()