Skip to content

Commit 27001ec

Browse files
neilddmitshur
authored andcommitted
[internal-branch.go1.17-vendor] http2: don't abort half-closed streams 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 <[email protected]> Run-TryBot: Damien Neil <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]> Reviewed-on: https://go-review.googlesource.com/c/net/+/357693 Reviewed-by: Dmitri Shuralyov <[email protected]>
1 parent f0a8156 commit 27001ec

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

http2/transport.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1933,7 +1933,13 @@ func (rl *clientConnReadLoop) cleanup() {
19331933
}
19341934
cc.closed = true
19351935
for _, cs := range cc.streams {
1936-
cs.abortStreamLocked(err)
1936+
select {
1937+
case <-cs.peerClosed:
1938+
// The server closed the stream before closing the conn,
1939+
// so no need to interrupt it.
1940+
default:
1941+
cs.abortStreamLocked(err)
1942+
}
19371943
}
19381944
cc.cond.Broadcast()
19391945
cc.mu.Unlock()

0 commit comments

Comments
 (0)