Skip to content

Commit 8c6315e

Browse files
committed
http2: on receiving rst_stream with cancel code, add it to pending list and process when it is safe
1 parent fdf625b commit 8c6315e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/node_http2.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2195,6 +2195,16 @@ int Http2Stream::SubmitPriority(const Http2Priority& priority,
21952195
void Http2Stream::SubmitRstStream(const uint32_t code) {
21962196
CHECK(!this->is_destroyed());
21972197
code_ = code;
2198+
2199+
// If RST_STREAM is submitted with the cancel code, don't force purge the
2200+
// currently sending data. Instead add it to the pending stream list to
2201+
// avoid prioritizing over other operations.
2202+
// Ref:https://github.com/nodejs/node/issues/38964
2203+
if (code_ == NGHTTP2_CANCEL) {
2204+
session_->AddPendingRstStream(id_);
2205+
return;
2206+
}
2207+
21982208
// If possible, force a purge of any currently pending data here to make sure
21992209
// it is sent before closing the stream. If it returns non-zero then we need
22002210
// to wait until the current write finishes and try again to avoid nghttp2

0 commit comments

Comments
 (0)