Skip to content

Commit 51769fd

Browse files
authored
H2 transport: Abandon client if client.Do(request) failed
See golang/go#30702 Fixes #2355
1 parent e603b97 commit 51769fd

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

transport/internet/http/dialer.go

+9
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,15 @@ func Dial(ctx context.Context, dest net.Destination, streamSettings *internet.Me
173173
if err != nil {
174174
newError("failed to dial to ", dest).Base(err).AtWarning().WriteToLog(session.ExportIDToError(ctx))
175175
wrc.Close()
176+
{
177+
// Abandon `client` if `client.Do(request)` failed
178+
// See https://github.com/golang/go/issues/30702
179+
globalDialerAccess.Lock()
180+
if globalDialerMap[dialerConf{dest, streamSettings}] == client {
181+
delete(globalDialerMap, dialerConf{dest, streamSettings})
182+
}
183+
globalDialerAccess.Unlock()
184+
}
176185
return
177186
}
178187
if response.StatusCode != 200 {

0 commit comments

Comments
 (0)