Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f638402

Browse filesBrowse files
indutnyrvagg
authored andcommitted
http: add comment about outputSize in res/server
PR-URL: #3128
1 parent 25e3b82 commit f638402
Copy full SHA for f638402

File tree

Expand file treeCollapse file tree

2 files changed

+11
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+11
-0
lines changed
Open diff view settings
Collapse file

‎lib/_http_outgoing.js‎

Copy file name to clipboardExpand all lines: lib/_http_outgoing.js
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,16 @@ utcDate._onTimeout = function() {
4646
function OutgoingMessage() {
4747
Stream.call(this);
4848

49+
// Queue that holds all currently pending data, until the response will be
50+
// assigned to the socket (until it will its turn in the HTTP pipeline).
4951
this.output = [];
5052
this.outputEncodings = [];
5153
this.outputCallbacks = [];
54+
55+
// `outputSize` is an approximate measure of how much data is queued on this
56+
// response. `_onPendingData` will be invoked to update similar global
57+
// per-connection counter. That counter will be used to pause/unpause the
58+
// TCP socket and HTTP Parser and thus handle the backpressure.
5259
this.outputSize = 0;
5360

5461
this.writable = true;
Collapse file

‎lib/_http_server.js‎

Copy file name to clipboardExpand all lines: lib/_http_server.js
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,10 @@ function connectionListener(socket) {
265265
var outgoingData = 0;
266266

267267
function updateOutgoingData(delta) {
268+
// `outgoingData` is an approximate amount of bytes queued through all
269+
// inactive responses. If more data than the high watermark is queued - we
270+
// need to pause TCP socket/HTTP parser, and wait until the data will be
271+
// sent to the client.
268272
outgoingData += delta;
269273
if (socket._paused && outgoingData < socket._writableState.highWaterMark)
270274
return socketOnDrain();

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.