stream: Fix readableState.awaitDrain mechanism
Pull Request check-list
Please make sure to review and check all of these items:
-
Does make -j8 test
(UNIX) orvcbuild test nosign
(Windows) pass with this change (including linting)? -
Is the commit message formatted according to CONTRIBUTING.md? -
If this change fixes a bug (or a performance problem), is a regression test (or a benchmark) included? -
Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
Affected core subsystem(s)
stream
Description of change
In 68990948 (https://github.com/nodejs/node/pull/2325), the conditions for increasing readableState.awaitDrain
when writing to a piping destination returns false were changed so that they could not actually be met, effectively leaving readableState.awaitDrain
with a constant value of 0.
This patch changes the conditions to testing whether the stream for which .write()
returned false is still a piping destination, which was likely the intention of the original patch.
Fixes: https://github.com/nodejs/node/issues/5820
/cc @mscdex