diff options
author | Daniele Belardi <dwon.dnl@gmail.com> | 2020-12-09 13:31:02 +0100 |
---|---|---|
committer | Node.js GitHub Bot <github-bot@iojs.org> | 2020-12-17 10:31:09 +0000 |
commit | 5ae96908696b7a017df3efb48ec1f8c8be5c24b8 (patch) | |
tree | 4be1bb8becb7d03b7c9f3c4221defb3c243922e6 /lib | |
parent | 70eaf55a9d2da25742df79a862edf16f122fdfbb (diff) | |
download | ios-node-v8-5ae96908696b7a017df3efb48ec1f8c8be5c24b8.tar.gz ios-node-v8-5ae96908696b7a017df3efb48ec1f8c8be5c24b8.tar.bz2 ios-node-v8-5ae96908696b7a017df3efb48ec1f8c8be5c24b8.zip |
http: add comments in _http_incoming
PR-URL: https://github.com/nodejs/node/pull/33035
Refs: https://github.com/nodejs/node/issues/30625
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/_http_incoming.js | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/_http_incoming.js b/lib/_http_incoming.js index 1b6099a89d..5442bfe7bb 100644 --- a/lib/_http_incoming.js +++ b/lib/_http_incoming.js @@ -171,6 +171,9 @@ IncomingMessage.prototype._destroy = function _destroy(err, cb) { // If aborted and the underlying socket not already destroyed, // destroy it. + // We have to check if the socket is already destroyed because finished + // does not call the callback when this methdod is invoked from `_http_client` + // in `test/parallel/test-http-client-spurious-aborted.js` if (this.socket && !this.socket.destroyed && this.aborted) { this.socket.destroy(err); const cleanup = finished(this.socket, (e) => { @@ -359,6 +362,9 @@ IncomingMessage.prototype._dump = function _dump() { }; function onError(instance, cb, error) { + // This is to keep backward compatible behavior. + // An error is emitted only if there are listeners attached to + // the event. if (instance.listenerCount('error') > 0) { cb(error); } else { |