diff options
author | Timothy J Fontaine <tjfontaine@gmail.com> | 2015-03-22 12:40:38 -0700 |
---|---|---|
committer | Timothy J Fontaine <tjfontaine@gmail.com> | 2015-03-24 14:09:16 -0700 |
commit | f840636e0abea6fd81db0a9da627f6937fbe0de3 (patch) | |
tree | 5d0e5692d9a74a57e8603eda7dec2df08c745fae | |
parent | 13f2e7c1177992566b1ec9d0313813da80953ce9 (diff) | |
download | node-f840636e0abea6fd81db0a9da627f6937fbe0de3.tar.gz |
streams: resume/pause should not fire after end
-rw-r--r-- | lib/_stream_readable.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js index e87c9f293..ec050811f 100644 --- a/lib/_stream_readable.js +++ b/lib/_stream_readable.js @@ -738,6 +738,9 @@ function resume(stream, state) { } function resume_(stream, state) { + if (state.ended) + return; + if (!state.reading) { debug('resume read 0'); stream.read(0); @@ -752,7 +755,8 @@ function resume_(stream, state) { Readable.prototype.pause = function() { debug('call pause flowing=%j', this._readableState.flowing); - if (false !== this._readableState.flowing) { + if (false !== this._readableState.flowing && + !this._readableState.ended) { debug('pause'); this._readableState.flowing = false; this.emit('pause'); |