http3: allow re-dialing of connection after a dial error (#4573)

* http3: do not cache dial error

* add an integration test

* http3: add a unit test for dial failures

---------

Co-authored-by: 世界 <i@sekai.icu>
This commit is contained in:
Marten Seemann
2024-06-23 12:38:49 +08:00
committed by GitHub
parent 10f8bd4e06
commit 2a082f973a
3 changed files with 56 additions and 0 deletions

View File

@@ -166,6 +166,7 @@ func (r *RoundTripper) RoundTripOpt(req *http.Request, opt RoundTripOpt) (*http.
}
if cl.dialErr != nil {
r.removeClient(hostname)
return nil, cl.dialErr
}
defer cl.useCount.Add(-1)
@@ -258,6 +259,7 @@ func (r *RoundTripper) getClient(ctx context.Context, hostname string, onlyCache
select {
case <-cl.dialing:
if cl.dialErr != nil {
delete(r.clients, hostname)
return nil, false, cl.dialErr
}
select {