http: add comment about outputSize
in res/server
PR-URL: https://github.com/nodejs/node/pull/3128
This commit is contained in:
parent
820735d967
commit
59cb053394
@ -46,9 +46,16 @@ utcDate._onTimeout = function() {
|
|||||||
function OutgoingMessage() {
|
function OutgoingMessage() {
|
||||||
Stream.call(this);
|
Stream.call(this);
|
||||||
|
|
||||||
|
// Queue that holds all currently pending data, until the response will be
|
||||||
|
// assigned to the socket (until it will its turn in the HTTP pipeline).
|
||||||
this.output = [];
|
this.output = [];
|
||||||
this.outputEncodings = [];
|
this.outputEncodings = [];
|
||||||
this.outputCallbacks = [];
|
this.outputCallbacks = [];
|
||||||
|
|
||||||
|
// `outputSize` is an approximate measure of how much data is queued on this
|
||||||
|
// response. `_onPendingData` will be invoked to update similar global
|
||||||
|
// per-connection counter. That counter will be used to pause/unpause the
|
||||||
|
// TCP socket and HTTP Parser and thus handle the backpressure.
|
||||||
this.outputSize = 0;
|
this.outputSize = 0;
|
||||||
|
|
||||||
this.writable = true;
|
this.writable = true;
|
||||||
|
@ -265,6 +265,10 @@ function connectionListener(socket) {
|
|||||||
var outgoingData = 0;
|
var outgoingData = 0;
|
||||||
|
|
||||||
function updateOutgoingData(delta) {
|
function updateOutgoingData(delta) {
|
||||||
|
// `outgoingData` is an approximate amount of bytes queued through all
|
||||||
|
// inactive responses. If more data than the high watermark is queued - we
|
||||||
|
// need to pause TCP socket/HTTP parser, and wait until the data will be
|
||||||
|
// sent to the client.
|
||||||
outgoingData += delta;
|
outgoingData += delta;
|
||||||
if (socket._paused && outgoingData < socket._writableState.highWaterMark)
|
if (socket._paused && outgoingData < socket._writableState.highWaterMark)
|
||||||
return socketOnDrain();
|
return socketOnDrain();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user