Skip to content

Commit

Permalink
[internal-branch.go1.17-vendor] http2: on write errors, close ClientC…
Browse files Browse the repository at this point in the history
…onn before returning from RoundTrip

Deflakes TestTransportRoundtripCloseOnWriteError.

Updates golang/go#49077

Change-Id: I4384d9091d55307d15fbd44b1b8137dcc8939c86
Reviewed-on: https://go-review.googlesource.com/c/net/+/356029
Trust: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-on: https://go-review.googlesource.com/c/net/+/357692
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
  • Loading branch information
neild authored and dmitshur committed Oct 29, 2021
1 parent 875be97 commit 94843a4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -1328,14 +1328,15 @@ func (cs *clientStream) cleanupWriteRequest(err error) {
if cs.ID != 0 {
cc.forgetStreamID(cs.ID)
}
close(cs.donec)

cc.wmu.Lock()
werr := cc.werr
cc.wmu.Unlock()
if werr != nil {
cc.Close()
}

close(cs.donec)
}

// awaitOpenSlotForStream waits until len(streams) < maxConcurrentStreams.
Expand Down

0 comments on commit 94843a4

Please sign in to comment.