Skip to content

Commit c4031f5

Browse files
neilddmitshur
authored andcommitted
[internal-branch.go1.16-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#49076 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/+/357098 Reviewed-by: Dmitri Shuralyov <[email protected]>
1 parent 2f744fa commit c4031f5

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
@@ -1937,7 +1937,13 @@ func (rl *clientConnReadLoop) cleanup() {
19371937
}
19381938
cc.closed = true
19391939
for _, cs := range cc.streams {
1940-
cs.abortStreamLocked(err)
1940+
select {
1941+
case <-cs.peerClosed:
1942+
// The server closed the stream before closing the conn,
1943+
// so no need to interrupt it.
1944+
default:
1945+
cs.abortStreamLocked(err)
1946+
}
19411947
}
19421948
cc.cond.Broadcast()
19431949
cc.mu.Unlock()

0 commit comments

Comments
 (0)