Commit Graph

3 Commits

Author SHA1 Message Date
Robert Nagy
c7e55c6b72 stream: fix writable.end callback behavior
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>
2020-07-01 18:18:04 +02:00
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