From d7d93077af7ba574e58d3a406c1b94de0664faad Mon Sep 17 00:00:00 2001 From: Ouyang Yadong Date: Wed, 17 Oct 2018 00:44:49 +0800 Subject: [PATCH 1/2] http2: add Http2Stream.bufferSize This commit adds `bufferSize` for `Http2Stream`. Refs: https://github.com/nodejs/node/issues/21631 --- doc/api/http2.md | 10 +++ lib/internal/http2/core.js | 6 ++ test/parallel/test-http2-buffersize.js | 51 +++++++++++++ .../test-tls-streamwrap-buffersize.js | 72 +++++++++++++++++++ 4 files changed, 139 insertions(+) create mode 100644 test/parallel/test-http2-buffersize.js create mode 100644 test/parallel/test-tls-streamwrap-buffersize.js diff --git a/doc/api/http2.md b/doc/api/http2.md index f3314695cfcc02..379dff96af1163 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -1012,6 +1012,15 @@ added: v8.4.0 Set to `true` if the `Http2Stream` instance was aborted abnormally. When set, the `'aborted'` event will have been emitted. +### http2stream.bufferSize + +* {number} + +This property shows the number of characters currently buffered to be written. +See [`net.Socket.bufferSize`][] for details. + #### http2stream.close(code[, callback]) @@ -3424,10 +3424,10 @@ following additional properties: [`http2stream.pushStream()`]: #http2_http2stream_pushstream_headers_options_callback [`net.Server.close()`]: net.html#net_server_close_callback [`net.Socket`]: net.html#net_class_net_socket +[`net.Socket.bufferSize`]: net.html#net_socket_buffersize [`net.Socket.prototype.ref()`]: net.html#net_socket_ref [`net.Socket.prototype.unref()`]: net.html#net_socket_unref [`net.connect()`]: net.html#net_net_connect -[`net.Socket.bufferSize`]: net.html#net_socket_buffersize [`request.socket.getPeerCertificate()`]: tls.html#tls_tlssocket_getpeercertificate_detailed [`response.end()`]: #http2_response_end_data_encoding_callback [`response.setHeader()`]: #http2_response_setheader_name_value