Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
http2: send out pending data earlier
If there’s a lot of data waiting on a given stream, send
it out early, if possible. This helps trigger the backpressure
mechanism introduced in 8a4a193 at a better time.
  • Loading branch information
addaleax committed Sep 1, 2019
commit e8713b3c0e1922ef4fc650076843f56f8ae6151d
5 changes: 4 additions & 1 deletion src/node_http2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1186,7 +1186,10 @@ int Http2Session::OnDataChunkReceived(nghttp2_session* handle,
stream->inbound_consumed_data_while_paused_ += avail;

// If we have a gathered a lot of data for output, try sending it now.
if (session->outgoing_length_ > 4096) session->SendPendingData();
if (session->outgoing_length_ > 4096 ||

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: not a c++ expert, but we can move 4096 to variable and re-use.

stream->available_outbound_length_ > 4096) {
session->SendPendingData();
}
} while (len != 0);

// If we are currently waiting for a write operation to finish, we should
Expand Down