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>
This commit is contained in:
parent
70eaf55a9d
commit
5ae9690869
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user