Skip to content

Commit

Permalink
[internal-branch.go1.16-vendor] http2: don't abort half-closed stream…
Browse files Browse the repository at this point in the history
…s on server connection close

If the server sends an END_STREAM for a stream and then closes the
connection, allow the stream to complete normally.

Updates golang/go#49076

Change-Id: Ia876e6e6e7eb4a0563db74c931c03a44620ece08
Reviewed-on: https://go-review.googlesource.com/c/net/+/356030
Trust: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-on: https://go-review.googlesource.com/c/net/+/357098
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
  • Loading branch information
neild authored and dmitshur committed Oct 29, 2021
1 parent 2f744fa commit c4031f5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion http2/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -1937,7 +1937,13 @@ func (rl *clientConnReadLoop) cleanup() {
}
cc.closed = true
for _, cs := range cc.streams {
cs.abortStreamLocked(err)
select {
case <-cs.peerClosed:
// The server closed the stream before closing the conn,
// so no need to interrupt it.
default:
cs.abortStreamLocked(err)
}
}
cc.cond.Broadcast()
cc.mu.Unlock()
Expand Down

0 comments on commit c4031f5

Please sign in to comment.