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
This commit is contained in:
Родитель
e543b0e95e
Коммит
b3f91f15b2
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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++) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче