Skip to content

Commit

Permalink
[internal-branch.go1.17-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#49077

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/+/357693
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
  • Loading branch information
neild authored and dmitshur committed Oct 29, 2021
1 parent 94843a4 commit d4eb795
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -1933,7 +1933,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 d4eb795

Please sign in to comment.