summaryrefslogtreecommitdiff
path: root/lib/stream.js
Commit message (Collapse)AuthorAgeFilesLines
* events: add check for listeners lengthTrevor Norris2013-03-011-4/+4
| | | | | | Ability to return just the length of listeners for a given type, using EventEmitter.listenerCount(emitter, event). This will be a lot cheaper than creating a copy of the listeners array just to check its length.
* streams2: The new stream base classesisaacs2012-12-131-4/+17
|
* streams: remove useless lineSoarez2012-10-211-1/+0
| | | | | The removed line was removing a calllback that was never setup in first place. 016afe2 forgot to remove this.
* streams: fix pipe is destructed by 'end' from destinationkoichik2012-10-031-1/+0
|
* stream.pipe: Don't call destroy() unless it's a functionisaacs2012-09-101-1/+1
|
* stream: don't call `cleanup` twice on `end` and `close`Maciej Małecki2012-05-281-6/+0
|
* Remove support for multi-source pipe()Felix Geisendörfer2011-11-221-19/+1
| | | | | | | 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
* throw from stdout.end and stderr.endIgor Zinkovsky2011-11-101-1/+1
|
* Directly export the Stream constructor.Nathan Rajlich2011-10-241-1/+3
| | | | | | | Also setting up a circular reference back to the stream as `Stream.Stream`, for backwards-compatibility. Fixes #1933
* Remove resume and pause eventsRyan Dahl2011-10-241-31/+6
| | | | Too complex; unnecessary.
* Close #1303 Stream.pipe returns the destinationElijah Insua2011-07-141-0/+3
| | | | | | | | | Squashed: * Simple change to make Stream.pipe(destination) return the destination Stream * Test: ensure Stream.pipe(destination) returns the destination Stream * updated Stream.pipe() documentation to reflect that it now returns the destination stream
* Fix error handling bug in stream.pipe()Felix Geisendörfer2011-05-241-1/+1
| | | | | | | | | | | | | | | | | | Problem: Since stream.pipe() is registering it's own error handlers on the source and destination stream, it needs to replicate the EventEmitter 'error' emitting semantics of throwing an error if there are no other listeners. However, there was a off-by-one error because the check for remaining listeners was done after cleanup() which means the pipe's own listener was no longer included. This would cause 'error' events on either the dest or the source to throw if there was one other error listener, and while swallowing the 'error' event if there was no other listener. Solution: I added a test demonstrating the two issues and fixed the problem by correcting the off-by-one error. Fixes #1095.
* cleartextstream.destroy() should destroy socket.Ryan Dahl2011-05-021-2/+20
| | | | | | This fixes a critical bug see in MJR's production. Very difficult to build a test case. Sometimes HTTPS server gets sockets that are hanging in a half-duplex state.
* Better stream.pipe() tracking.isaacs2011-04-271-25/+43
| | | | | | | | | | | | | | | | | | | | | | | | This commit does three things: 1. Uses an exposed counter rather than a hidden array for tracking dest streams that may have multiple inputs. This allows for significantly faster lookups, since the counter can be checked in constant time rather than searching an array for the dest object. (A proper O(1) WeakMap would be better, but that may have to wait for Harmony.) 2. Calls the 'end' event logic when there is an 'error' event on the source object (and then throws if there are no other error listeners.) This is important, because otherwise 'error' events would lead to memory leaks. 3. Clean up the style a bit. Function Declarations are not allowed within blocks in ES strict. Prefer Function Declarations to Function Expressions, because hoisting allows for more expressive ordering of logic. Downside: It adds "_pipeCount" as part of the Stream API. It'll work fine if the member is missing, but if anyone tries to use it for some other purpose, it can mess things up.
* Fix: Multiple pipes to the same stream were brokenFelix Geisendörfer2011-04-141-8/+21
| | | | | | | | | | When creating multiple .pipe()s to the same destination stream, the first source to end would close the destination, breaking all remaining pipes. This patch fixes the problem by keeping track of all open pipes, so that we only call end on destinations that have no more sources piping to them. closes #929
* Fix listener leak in stream.pipe()Mikeal Rogers2011-03-281-12/+30
|
* Update copyright headersRyan Dahl2011-03-141-0/+21
|
* Add 'pipe' eventMikeal Rogers2011-02-091-0/+2
|
* Revert "Add optional filters to stream.pipe()"Ryan Dahl2011-01-011-41/+2
| | | | This reverts commit 24aded078fd6838d2f21934e57c7cc8dfd7303d1.
* Add optional filters to stream.pipe()Ryan Dahl2010-12-171-2/+41
|
* lintRyan Dahl2010-12-011-14/+14
|
* more lintRyan Dahl2010-12-011-1/+1
|
* Fix test-securepair-serverRyan Dahl2010-11-231-3/+5
|
* stream.pipe should remove listeners on dest closeRyan Dahl2010-11-201-6/+19
|
* Soft migration of sys -> util, Removal of deprecated utils module.Micheil Smith2010-10-111-2/+2
|
* pipe-test fixesRyan Dahl2010-10-101-1/+1
|
* clean up options.end code - wasn't workingRyan Dahl2010-10-101-3/+1
|
* Add Stream base class with stream.pipeRyan Dahl2010-10-101-0/+57