This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
1 changed file
with
43 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 comment
on commit 7c6f014
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible that this change is responsible for this regression #728 It appears to have been introduced in v0.4.8.
@isaacs Shouldn't this be === 0? The cleanup() call before this is already removing the 'error' listener we attached ourselves.