| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -171,6 +171,9 @@ IncomingMessage.prototype._destroy = function _destroy(err, cb) { | |||
| 171 | 171 | ||
| 172 | 172 | // If aborted and the underlying socket not already destroyed, | |
| 173 | 173 | // destroy it. | |
| 174 | + // We have to check if the socket is already destroyed because finished | ||
| 175 | + // does not call the callback when this methdod is invoked from `_http_client` | ||
| 176 | + // in `test/parallel/test-http-client-spurious-aborted.js` | ||
| 174 | 177 | if (this.socket && !this.socket.destroyed && this.aborted) { | |
| 175 | 178 | this.socket.destroy(err); | |
| 176 | 179 | const cleanup = finished(this.socket, (e) => { | |
@@ -359,6 +362,9 @@ IncomingMessage.prototype._dump = function _dump() { | |||
| 359 | 362 | }; | |
| 360 | 363 | ||
| 361 | 364 | function onError(instance, cb, error) { | |
| 365 | + // This is to keep backward compatible behavior. | ||
| 366 | + // An error is emitted only if there are listeners attached to | ||
| 367 | + // the event. | ||
| 362 | 368 | if (instance.listenerCount('error') > 0) { | |
| 363 | 369 | cb(error); | |
| 364 | 370 | } else { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments