From 51a52c43a2887b354af55a891e478a6b4b194a79 Mon Sep 17 00:00:00 2001 From: isaacs Date: Wed, 3 Oct 2012 17:43:27 -0700 Subject: [PATCH] streams2: Set flowing=true when flowing --- lib/_stream_readable.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js index b71c22aecf..7b2d76c534 100644 --- a/lib/_stream_readable.js +++ b/lib/_stream_readable.js @@ -159,8 +159,10 @@ Readable.prototype.pipe = function(dest, pipeOpts) { dest.emit('pipe', src); // start the flow. - if (!state.flowing) + if (!state.flowing) { + state.flowing = true; process.nextTick(flow.bind(null, src, pipeOpts)); + } return dest; }; @@ -168,7 +170,6 @@ Readable.prototype.pipe = function(dest, pipeOpts) { function flow(src, pipeOpts) { var state = src._readableState; var chunk; - var dest; var needDrain = 0; function ondrain() {