diff options
author | Anna Henningsen <anna@addaleax.net> | 2019-09-02 02:36:03 +0300 |
---|---|---|
committer | Beth Griggs <Bethany.Griggs@uk.ibm.com> | 2019-10-18 00:09:06 +0300 |
commit | 66387cd45e2c208210e0741edd89c91ede779457 (patch) | |
tree | 2a1dc80b8f12d050f598db61dc378a5398016050 /src | |
parent | e8c90bf4d1312b35f066001a183844356bf79e33 (diff) |
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 8a4a1931b8b98 at a better time.
PR-URL: https://github.com/nodejs/node/pull/29398
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/node_http2.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/node_http2.cc b/src/node_http2.cc index cdf83350bb2..21051e17219 100644 --- a/src/node_http2.cc +++ b/src/node_http2.cc @@ -1224,7 +1224,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 || + stream->available_outbound_length_ > 4096) { + session->SendPendingData(); + } } while (len != 0); // If we are currently waiting for a write operation to finish, we should |