Changes so that the end() callback behaves the same way in relation
to _final as write() does to _write/_writev.
PR-URL: https://github.com/nodejs/node/pull/34101
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
It doesn't make much sense to flush a stream which has been destroyed.
PR-URL: https://github.com/nodejs/node/pull/29028
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
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.
PR-URL: https://github.com/nodejs/node/pull/24062
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>