summaryrefslogtreecommitdiff
path: root/lib/_stream_readable.js
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2016-10-18 22:30:03 +0200
committerMyles Borins <mborins@us.ibm.com>2016-10-19 14:00:02 +0100
commit8043ca79c556619741defe929d6a0c4b8e98922c (patch)
treef2db49f29d15ce8f8d466a8e8a590b4dbdd8a388 /lib/_stream_readable.js
parentbb173f931ae85b464e901806f15dcc219dec6b73 (diff)
downloadandroid-node-v8-8043ca79c556619741defe929d6a0c4b8e98922c.tar.gz
android-node-v8-8043ca79c556619741defe929d6a0c4b8e98922c.tar.bz2
android-node-v8-8043ca79c556619741defe929d6a0c4b8e98922c.zip
streams: fix regression in `unpipe()`
Since 2e568d9 there is a bug where unpiping a stream from a readable stream that has `_readableState.pipesCount > 1` will cause it to remove the first stream in the `_.readableState.pipes` array no matter where in the list the `dest` stream was. This patch corrects that problem. PR-URL: https://github.com/nodejs/node/pull/9171 Fixes: https://github.com/nodejs/node/issues/9170 Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com>
Diffstat (limited to 'lib/_stream_readable.js')
-rw-r--r--lib/_stream_readable.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js
index 9438bf92d3..0844604d96 100644
--- a/lib/_stream_readable.js
+++ b/lib/_stream_readable.js
@@ -671,7 +671,7 @@ Readable.prototype.unpipe = function(dest) {
if (index === -1)
return this;
- state.pipes.splice(i, 1);
+ state.pipes.splice(index, 1);
state.pipesCount -= 1;
if (state.pipesCount === 1)
state.pipes = state.pipes[0];