GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — http: fast-forward teardown of unread messages · nodejs/node@e3cc0d9

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib
    • _http_incoming.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/_http_incoming.js‎

Copy file name to clipboardExpand all lines: lib/_http_incoming.js
+15-1Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,13 @@ IncomingMessage.prototype._destroy = function _destroy(err, cb) {
292292
cleanup();
293293
process.nextTick(onError, this, e || err, cb);
294294
});
295+
} else if (err == null && !this.aborted) {
296+
// The message was received completely and is being destroyed cleanly:
297+
// complete the destroy synchronously. 'close' is still emitted on a
298+
// later tick by the stream machinery. The deferral below only exists
299+
// so that 'error' listeners attached right after destroy(err) still
300+
// receive the error, which cannot matter when there is no error.
301+
cb();
295302
} else {
296303
process.nextTick(onError, this, err, cb);
297304
}
@@ -505,7 +512,14 @@ IncomingMessage.prototype._dump = function _dump() {
505512
// If there is buffered data, it may trigger 'data' events.
506513
// Remove 'data' event listeners explicitly.
507514
this.removeAllListeners('data');
508-
this.resume();
515+
if (this.complete && !this.destroyed && this.readableLength === 0) {
516+
// The message was fully received and never read: there is nothing to
517+
// pull off the wire. Go straight to the 'end' emission instead of
518+
// paying for the resume() and flow() scheduling machinery.
519+
this.read(0);
520+
} else {
521+
this.resume();
522+
}
509523
}
510524
};
511525

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.