2 Commits

Author SHA1 Message Date
Robert Nagy
aa32e13968 stream: do not flush destroyed writable
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>
2019-09-22 16:25:50 -07:00
Anna Henningsen
d3f02d0da3
stream: make .destroy() interact better with write queue
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>
2018-11-10 21:54:48 +01:00