stream: pause/resume on destroyed streams should be noop by ronag · Pull Request #62557 · nodejs/node

Expand Up @@ -1238,6 +1238,9 @@ function nReadingNextTick(self) { // If the user uses them, then switch into old mode. Readable.prototype.resume = function() { const state = this._readableState; if ((state[kState] & kDestroyed) !== 0) { return this; } if ((state[kState] & kFlowing) === 0) { debug('resume'); // We flow only if there is no one listening Expand Down Expand Up @@ -1278,6 +1281,9 @@ function resume_(stream, state) {
Readable.prototype.pause = function() { const state = this._readableState; if ((state[kState] & kDestroyed) !== 0) { return this; } debug('call pause'); if ((state[kState] & (kHasFlowing | kFlowing)) !== kHasFlowing) { debug('pause'); Expand Down