diff options
author | Robert Nagy <ronagy@icloud.com> | 2019-09-08 10:35:34 +0200 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2019-09-22 15:55:15 -0700 |
commit | ec390b63a1989d5da0ec7043f7e2e91398212877 (patch) | |
tree | 8f133aa5366591c0d692473f0a71a02611a393a7 /lib | |
parent | 8709a408d2eb31a996077cf0ea48c5fbba93adae (diff) | |
download | node-new-ec390b63a1989d5da0ec7043f7e2e91398212877.tar.gz |
stream: do not call _read() after destroy()
PR-URL: https://github.com/nodejs/node/pull/29491
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/_stream_readable.js | 7 | ||||
-rw-r--r-- | lib/internal/fs/streams.js | 3 |
2 files changed, 4 insertions, 6 deletions
diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js index 7502a1ac2c..2dc1323f09 100644 --- a/lib/_stream_readable.js +++ b/lib/_stream_readable.js @@ -490,9 +490,10 @@ Readable.prototype.read = function(n) { debug('length less than watermark', doRead); } - // However, if we've ended, then there's no point, and if we're already - // reading, then it's unnecessary. - if (state.ended || state.reading) { + // However, if we've ended, then there's no point, if we're already + // reading, then it's unnecessary, and if we're destroyed, then it's + // not allowed. + if (state.ended || state.reading || state.destroyed) { doRead = false; debug('reading or ended', doRead); } else if (doRead) { diff --git a/lib/internal/fs/streams.js b/lib/internal/fs/streams.js index d51fbb1b58..b0c4224893 100644 --- a/lib/internal/fs/streams.js +++ b/lib/internal/fs/streams.js @@ -137,9 +137,6 @@ ReadStream.prototype._read = function(n) { }); } - if (this.destroyed) - return; - if (!pool || pool.length - pool.used < kMinPoolSpace) { // Discard the old pool. allocNewPool(this.readableHighWaterMark); |