stream: make `.destroy()` interact better with write queue
@nodejs/streams @mcollina @mafintosh I’m mostly looking for feedback on the idea here rather than the implementation, i.e., does this make sense, is this the right behaviour, etc.? Also, does the test modification here mean that we might have to consider this a breaking change rather than a bugfix?
Make sure that it is safe to call the callback for _write()
even in the presence of .destroy()
calls during that write.
In particular, letting the write queue continue processing would
previously have thrown an exception, because processing writes
after calling .destroy()
is forbidden.
One test had to be modified to account for the fact that callbacks
for writes will now always be called, even when the stream
is destroyed during the process.
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines