Skip to content

stream: fix y.pipe(x)+y.pipe(x)+y.unpipe(x) scenario

Fix the uncommon situation when a readable stream is piped twice into the same destination stream, and then unpiped once.

Previously, the unpipe event handlers weren’t able to tell whether they were corresponding to the “right” conceptual pipe that was being removed; this fixes this by adding a counter to the unpipe event handler and only removing a single piping destination at most.

Fixes: https://github.com/nodejs/node/issues/12718

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

stream

Merge request reports

Loading