Skip to content

Commit

Permalink
H2 transport: Abandon client if client.Do(request) failed
Browse files Browse the repository at this point in the history
  • Loading branch information
RPRX committed Jul 21, 2023
1 parent e603b97 commit 51769fd
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions transport/internet/http/dialer.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,15 @@ func Dial(ctx context.Context, dest net.Destination, streamSettings *internet.Me
if err != nil {
newError("failed to dial to ", dest).Base(err).AtWarning().WriteToLog(session.ExportIDToError(ctx))
wrc.Close()
{
// Abandon `client` if `client.Do(request)` failed
// See https://github.com/golang/go/issues/30702
globalDialerAccess.Lock()
if globalDialerMap[dialerConf{dest, streamSettings}] == client {
delete(globalDialerMap, dialerConf{dest, streamSettings})
}
globalDialerAccess.Unlock()
}
return
}
if response.StatusCode != 200 {
Expand Down

0 comments on commit 51769fd

Please sign in to comment.