From b3f91f15b2482a8f3e5d37f0e09429a4b4775230 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Geisendo=CC=88rfer?= Date: Mon, 21 Nov 2011 22:57:33 +0100 Subject: [PATCH] Remove support for multi-source pipe() This reverts 6c5b31bd which had too few use cases, too much complexity, and can be handled in user-land by using `{end: false}`. Closes #1996 --- lib/stream.js | 20 +------------------- test/simple/test-stream-pipe-cleanup.js | 10 ---------- 2 files changed, 1 insertion(+), 29 deletions(-) diff --git a/lib/stream.js b/lib/stream.js index fa45b8b1e15..d6da2525f95 100644 --- a/lib/stream.js +++ b/lib/stream.js @@ -52,12 +52,8 @@ Stream.prototype.pipe = function(dest, options) { dest.on('drain', ondrain); // If the 'end' option is not supplied, dest.end() will be called when - // source gets the 'end' or 'close' events. Only dest.end() once, and - // only when all sources have ended. + // source gets the 'end' or 'close' events. Only dest.end() once. if (!dest._isStdio && (!options || options.end !== false)) { - dest._pipeCount = dest._pipeCount || 0; - dest._pipeCount++; - source.on('end', onend); source.on('close', onclose); } @@ -67,16 +63,9 @@ Stream.prototype.pipe = function(dest, options) { if (didOnEnd) return; didOnEnd = true; - dest._pipeCount--; - // remove the listeners cleanup(); - if (dest._pipeCount > 0) { - // waiting for other incoming streams to end. - return; - } - dest.end(); } @@ -85,16 +74,9 @@ Stream.prototype.pipe = function(dest, options) { if (didOnEnd) return; didOnEnd = true; - dest._pipeCount--; - // remove the listeners cleanup(); - if (dest._pipeCount > 0) { - // waiting for other incoming streams to end. - return; - } - dest.destroy(); } diff --git a/test/simple/test-stream-pipe-cleanup.js b/test/simple/test-stream-pipe-cleanup.js index c2df97019ba..aa504c41644 100644 --- a/test/simple/test-stream-pipe-cleanup.js +++ b/test/simple/test-stream-pipe-cleanup.js @@ -77,16 +77,6 @@ assert.equal(limit, w.endCalls); w.endCalls = 0; -var r2; -r = new Readable(); -r2 = new Readable(); - -r.pipe(w); -r2.pipe(w); -r.emit('close'); -r2.emit('close'); -assert.equal(1, w.endCalls); - r = new Readable(); for (i = 0; i < limit; i++) {