mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
WebStream's Readable controller does not tolerate `.close()` being called after an `error`. However, when wrapping a Node's Readable stream it is possible that the sequence of events leads to `finished()`'s callback being invoked after such `error`. In order to handle this, in this change we call the `finished()` handler earlier when controller is canceled, and always handle this as an error case. Fix: https://github.com/nodejs/node/issues/54205 PR-URL: https://github.com/nodejs/node/pull/54206 Fixes: https://github.com/nodejs/node/issues/54205 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Mattias Buelens <mattias@buelens.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>