Skip to content

Commit

Permalink
http2: on receiving rst_stream with cancel code, add it to pending li…
Browse files Browse the repository at this point in the history
…st and process when it is safe
  • Loading branch information
kumarak committed Jul 18, 2021
1 parent fdf625b commit 8c6315e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/node_http2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2195,6 +2195,16 @@ int Http2Stream::SubmitPriority(const Http2Priority& priority,
void Http2Stream::SubmitRstStream(const uint32_t code) {
CHECK(!this->is_destroyed());
code_ = code;

// If RST_STREAM is submitted with the cancel code, don't force purge the
// currently sending data. Instead add it to the pending stream list to
// avoid prioritizing over other operations.
// Ref:https://github.com/nodejs/node/issues/38964
if (code_ == NGHTTP2_CANCEL) {
session_->AddPendingRstStream(id_);
return;
}

// If possible, force a purge of any currently pending data here to make sure
// it is sent before closing the stream. If it returns non-zero then we need
// to wait until the current write finishes and try again to avoid nghttp2
Expand Down

0 comments on commit 8c6315e

Please sign in to comment.