Commit Graph

277 Commits

Author SHA1 Message Date
Robert Nagy
415726b8c4 stream: add writableAborted
PR-URL: https://github.com/nodejs/node/pull/40802
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2021-11-18 07:40:13 +01:00
Robert Nagy
640bfb8d70 stream: fix non readable Duplex readableAborted
PR-URL: https://github.com/nodejs/node/pull/40801
Fixes: https://github.com/nodejs/node/issues/40800
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2021-11-15 14:45:46 +02:00
Robert Nagy
afe460ec9e stream: allow calling callback before promise
Refs: https://github.com/nodejs/node/issues/39535

PR-URL: https://github.com/nodejs/node/pull/40772
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-11-14 15:52:22 +02:00
Robert Nagy
f2170253b6 stream: add errored and closed props
PR-URL: https://github.com/nodejs/node/pull/40696
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-11-13 11:19:32 +02:00
Robert Nagy
47fb8676ff stream: remove no longer necessary ComposeDuplex
PR-URL: https://github.com/nodejs/node/pull/40545
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2021-10-23 22:23:35 +00:00
Mestery
b920a10162
stream: support array of streams in promises pipeline
Fixes: https://github.com/nodejs/node/issues/40191

PR-URL: https://github.com/nodejs/node/pull/40193
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-10-20 19:47:34 +08:00
Robert Nagy
0f78d2600b stream: fix fromAsyncGen
Fixes: https://github.com/nodejs/node/issues/40497

PR-URL: https://github.com/nodejs/node/pull/40499
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2021-10-19 13:55:06 +00:00
Maledong
8900a4663f
lib: remove useless statement
There's no need to set 'false' to 'isAsync' because we've declared it
before.

PR-URL: https://github.com/nodejs/node/pull/39983
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
2021-09-18 16:05:59 +02:00
Rongjian Zhang
0c6f345cda stream: fix highwatermark threshold and add the missing error
1. Fix highwatermark threshold: `< 1GiB` -> `<= 1GiB`
2. Add the missing error: Size out of range

Update test/parallel/test-streams-highwatermark.js

Co-authored-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/38700
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2021-09-07 14:28:20 +00:00
Robert Nagy
c04d621ecc stream: add signal support to pipeline generators
Generators in pipeline must be able to be aborted or pipeline
can deadlock.

PR-URL: https://github.com/nodejs/node/pull/39067
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-08-25 17:44:28 +02:00
Robert Nagy
4832d1c02c stream: add isDisturbed helper
Adds a helper util used to determine whether a stream has been
disturbed (read or cancelled).

Refs: https://github.com/nodejs/node/issues/39627

PR-URL: https://github.com/nodejs/node/pull/39628
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2021-08-06 07:45:38 +02:00
Robert Nagy
0e841b45c2 stream: don't emit 'data' after 'error' or 'close'
As per doc we should not emit further events after 'close' and
only 'close' after 'error'.

Fixes: https://github.com/nodejs/node/issues/39630

PR-URL: https://github.com/nodejs/node/pull/39639
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2021-08-06 07:44:09 +02:00
Mestery
712059a232 stream: clean endWritableNT
The `state` argument was unused.

PR-URL: https://github.com/nodejs/node/pull/39645
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
2021-08-05 16:01:55 +00:00
Szymon Marczak
ef992f6de9 stream: do not emit end on readable error
PR-URL: https://github.com/nodejs/node/pull/39607
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-08-05 09:58:01 +00:00
Robert Nagy
533cafcf7e stream: duplexify
PR-URL: https://github.com/nodejs/node/pull/39519
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2021-08-03 10:47:10 +02:00
Robert Nagy
ac621ff5e7 stream: add readableDidRead if has been read from
Adds did read accessor used to determine whether a readable has been
read from.

PR-URL: https://github.com/nodejs/node/pull/39589
Refs: https://github.com/nodejs/undici/pull/907
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2021-08-02 05:59:18 -07:00
Robert Nagy
79f4d5a345 stream: fix toWeb typo
PR-URL: https://github.com/nodejs/node/pull/39496
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2021-07-25 19:32:51 +02:00
Robert Nagy
e579acb8dc stream: add stream.compose
Refs: #32020

PR-URL: https://github.com/nodejs/node/pull/39029
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2021-07-19 08:14:32 +02:00
Robert Nagy
efd40eadab stream: forward errored to callback
Refs: https://github.com/nodejs/node/issues/39356

PR-URL: https://github.com/nodejs/node/pull/39364
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2021-07-14 13:05:10 +02:00
Robert Nagy
8306051001 stream: add readableDidRead
Adds readableDidRead to streams and applies usage to http, http2 and quic.

PR-URL: https://github.com/nodejs/node/pull/36820
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2021-07-14 12:01:41 +02:00
James M Snell
a99c230305
stream: implement streams to webstreams adapters
Experimental adapters for the webstreams API

Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/39134
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2021-07-13 10:03:16 -07:00
Robert Nagy
09d8c0c8d2 stream: destroy readable on read error
PR-URL: https://github.com/nodejs/node/pull/39342
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2021-07-12 12:08:43 +02:00
Robert Nagy
a5dec3a470 stream: validate abort signal
PR-URL: https://github.com/nodejs/node/pull/39346
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2021-07-12 12:06:57 +02:00
Robert Nagy
f2f6872b5c stream: cleanup async handling
Cleanup async stream method handling.

PR-URL: https://github.com/nodejs/node/pull/39329
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-07-11 19:20:01 +02:00
Robert Nagy
7a7ba82234 stream: don't emit prefinish after error or close
PR-URL: https://github.com/nodejs/node/pull/39332
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-07-11 18:41:17 +02:00
Robert Nagy
5960f16713 tls: move legacy code into own file
PR-URL: https://github.com/nodejs/node/pull/39333
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2021-07-11 18:40:18 +02:00
Robert Nagy
bb275ef2a4 stream: unify stream utils
Unify stream helps into utils.

PR-URL: https://github.com/nodejs/node/pull/39294
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-07-11 10:40:30 +02:00
Brian White
a5ba28dda2 stream: fix performance regression
PR-URL: https://github.com/nodejs/node/pull/39254
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-07-08 08:15:25 +02:00
Robert Nagy
ce00381751 stream: use finished for async iteration
PR-URL: https://github.com/nodejs/node/pull/39282
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-07-08 08:10:37 +02:00
Darshan Sen
b2ae12d422 stream: throw on premature close in Readable[AsyncIterator]
Fixes: https://github.com/nodejs/node/issues/39086
Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/39117
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2021-07-05 15:17:28 +00:00
Robert Nagy
0738a2b7bd stream: finished should error on errored stream
Calling finished before or after a stream has errored or closed
should end up with the same behavior.

PR-URL: https://github.com/nodejs/node/pull/39235
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2021-07-04 20:52:39 -07:00
Robert Nagy
954217adda stream: error Duplex write/read if not writable/readable
If writable/readable has been explicitly disabled then using
a Duplex as writable/readable should fail.

Fixes: https://github.com/nodejs/node/issues/34374

PR-URL: https://github.com/nodejs/node/pull/34385
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2021-07-02 22:11:16 +02:00
Robert Nagy
320339630d stream: use finished for pump
Re-use existing compat logic for pump by using
finished.

PR-URL: https://github.com/nodejs/node/pull/39203
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2021-07-02 10:12:45 +02:00
Robert Nagy
f4609bdf3f
stream: bypass legacy destroy for pipeline and async iteration
PR-URL: https://github.com/nodejs/node/pull/38505
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-06-15 19:43:49 +02:00
Robert Nagy
bdcb7389ed
stream: fix pipeline pump
Refs: https://github.com/nodejs/node/issues/39005

PR-URL: https://github.com/nodejs/node/pull/39006
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-06-14 08:13:12 -07:00
Joyee Cheung
a4ea9fc48e
lib: remove unnecessary lazy loads
Now that more modules are included in the snapshot, it's not
necessary to lazy load them anymore

PR-URL: https://github.com/nodejs/node/pull/38737
Refs: https://github.com/nodejs/node/issues/35711
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2021-05-27 21:46:48 +08:00
Nitzan Uziely
df85d37050
stream: add a non-destroying iterator to Readable
add a non-destroying iterator to Readable

fixes: https://github.com/nodejs/node/issues/38491

PR-URL: https://github.com/nodejs/node/pull/38526
Fixes: https://github.com/nodejs/node/issues/38491
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2021-05-25 07:22:29 -07:00
Qingyu Deng
b9ef539eae
stream: allow empty string as source of pipeline
Fixes: https://github.com/nodejs/node/issues/38721

PR-URL: https://github.com/nodejs/node/pull/38723
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
2021-05-20 09:46:47 -07:00
Antoine du Hamel
ee9e2a2eb6 lib: revert primordials in a hot path
Evidence has shown that use of primordials have sometimes an impact of
performance. This commit reverts the changes who are most likely to be
responsible for performance regression in the HTTP response path.

PR-URL: https://github.com/nodejs/node/pull/38248
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2021-04-19 10:23:01 +02:00
Robert Nagy
369f239503 stream: fix multiple Writable.destroy() calls
Calling Writable.destroy() multiple times in the same tick
could cause an assertion error.

Fixes: https://github.com/nodejs/node/issues/38189

PR-URL: https://github.com/nodejs/node/pull/38221
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Nitzan Uziely <linkgoron@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2021-04-16 12:00:19 +02:00
Matteo Collina
2fa7d33e74 Revert "net: add support for finished after .destroy()"
This reverts commit 2da36112d1.

PR-URL: https://github.com/nodejs/node/pull/37964
Refs: https://github.com/nodejs/node/issues/37937
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2021-03-31 19:06:53 +02:00
Nitzan Uziely
9b87ab4071
stream: pipeline accept Buffer as a valid first argument
change isStream to also check existence of on, so it
wont mistake buffers as Streams.

fixes: https://github.com/nodejs/node/issues/37731

PR-URL: https://github.com/nodejs/node/pull/37739
Fixes: https://github.com/nodejs/node/issues/37731
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-03-22 08:22:56 -07:00
wwwzbwcom
2c251ff33a stream: make Readable.from performance better
PR-URL: https://github.com/nodejs/node/pull/37609
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2021-03-22 11:19:35 +02:00
Antoine du Hamel
104dac79cc lib: aggregate errors to avoid error swallowing
Uses `AggregateError` if there are more than one error with the message
of the outer error to preserve the current behaviour, or returns the
logical OR comparison of the two parameters.

PR-URL: https://github.com/nodejs/node/pull/37460
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
2021-03-19 12:43:03 +01:00
Luigi Pinca
e84e6e7fad stream,util: fix "the the" typo in comments
PR-URL: https://github.com/nodejs/node/pull/37674
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2021-03-13 10:01:19 +01:00
Rich Trott
1e34df139c stream: move duplicated code to an internal module
Create a utils module for isIterable(), isReadable(), and isStream().

PR-URL: https://github.com/nodejs/node/pull/37508
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2021-02-28 05:07:26 -08:00
Nitzan Uziely
7837d3fde9 stream: add AbortSignal support to finished
PR-URL: https://github.com/nodejs/node/pull/37354
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2021-02-26 11:21:24 +01:00
Rich Trott
b461a1b125 doc,lib: prepare for stricter multi-line array linting
We're about to turn on a requirement for dangling commas.

PR-URL: https://github.com/nodejs/node/pull/37088
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2021-02-19 09:55:35 -08:00
Benjamin Gruenbaum
03380bc16a stream: improve Readable.from error handling
PR-URL: https://github.com/nodejs/node/pull/37158
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2021-02-03 12:04:37 +02:00
Antoine du Hamel
4ad46e2fef stream: refactor to avoid unsafe array iteration
PR-URL: https://github.com/nodejs/node/pull/37126
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
2021-02-01 15:20:35 +01:00
Antoine du Hamel
419686cdfb stream: refactor to use more primordials
PR-URL: https://github.com/nodejs/node/pull/36346
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
2021-02-01 15:18:25 +01:00
ZiJian Liu
029d1fd797 lib: refactor to use validateObject
Co-authored-by: ExE Boss <3889017+ExE-Boss@users.noreply.github.com>
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/37028
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-01-28 12:53:50 +01:00
ZiJian Liu
064a7070c7 lib: refactor to use validateFunction
add validateFunction and refactor to use validateFunction

PR-URL: https://github.com/nodejs/node/pull/37045
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-01-27 20:46:54 +02:00
Robert Nagy
52546c091d
stream: finished waits for 'close' on OutgoingMessage
Don't invoke finished callback until OutgoingMessagehas
emitted 'close'.

PR-URL: https://github.com/nodejs/node/pull/36648
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-01-11 11:39:33 -08:00
Robert Nagy
a4fce32eab stream: fix .end() error propagation
PR-URL: https://github.com/nodejs/node/pull/36817
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2021-01-11 17:57:05 +01:00
Momtchil Momtchev
053abac02b stream: lazy read ReadStream
Using stream._construct would cause the Readable
to incorrectly greedily start reading.

Fixes: https://github.com/nodejs/node/issues/36251

PR-URL: https://github.com/nodejs/node/pull/36823
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2021-01-10 19:06:06 +01:00
Robert Nagy
2da36112d1
net: add support for finished after .destroy()
Calling `finished(socket, cb)` would previously not
invoked the callback if the socket was already detroyed.

PR-URL: https://github.com/nodejs/node/pull/36635
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-01-04 13:17:19 -08:00
Nitzan Uziely
51b4367506
net: support abortSignal in server.listen
PR-URL: https://github.com/nodejs/node/pull/36623
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-12-31 12:44:33 -08:00
Robert Nagy
faee7399b2 stream: only use legacy close listeners if not willEmitClose
Some streams that willEmitClose unecessarily fallback to legacy
events.

PR-URL: https://github.com/nodejs/node/pull/36649
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2020-12-30 15:28:32 +00:00
ZiJian Liu
b00bb01db9 lib: refactor to use validateCallback
PR-URL: https://github.com/nodejs/node/pull/36609
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2020-12-29 15:48:57 +00:00
Matteo Collina
e57d8af7e2 stream,zlib: do not use _stream_* anymore
PR-URL: https://github.com/nodejs/node/pull/36618
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2020-12-29 01:47:57 +01:00
Robert Nagy
ab895bd587 stream: fix pipe deadlock when starting with needDrain
Fixes: https://github.com/nodejs/node/issues/36544

PR-URL: https://github.com/nodejs/node/pull/36563
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2020-12-20 10:27:35 +01:00
ZiJian Liu
6837a6de97 stream: accept iterable as a valid first argument
Fixes: https://github.com/nodejs/node/issues/36437

PR-URL: https://github.com/nodejs/node/pull/36479
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2020-12-15 13:40:40 +00:00
Benjamin Gruenbaum
040a27ae5f stream: support abortsignal in constructor
PR-URL: https://github.com/nodejs/node/pull/36431
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2020-12-10 23:39:18 +02:00
Michaël Zasso
bf31d3c3b1
tools: enable no-unused-expressions lint rule
Fixes: https://github.com/nodejs/node/issues/36246

PR-URL: https://github.com/nodejs/node/pull/36248
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-12-07 20:33:45 +01:00
Benjamin Gruenbaum
5bd1eecfa9 stream: support abort signal
PR-URL: https://github.com/nodejs/node/pull/36061
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
2020-12-07 16:08:31 +00:00
Gil Pedersen
3c38445cc8 stream: fix thrown object reference
PR-URL: https://github.com/nodejs/node/pull/36065
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2020-11-10 16:34:35 +00:00
Robert Nagy
dd0f8f18c2 stream: writableNeedDrain
Don't write to a stream which already has a full buffer.

Fixes: https://github.com/nodejs/node/issues/35341

PR-URL: https://github.com/nodejs/node/pull/35348
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2020-11-10 10:44:16 +01:00
Antoine du Hamel
ad98cf04f3 stream: remove isPromise utility function
The function was not checking if the parameter was actually a Promise
instance, but if it has a `then` method. Removing the utility function
in favor of a clearer `typeof` check, handling the case when the
thenable throws if then method is accessed more than once.

PR-URL: https://github.com/nodejs/node/pull/35925
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2020-11-09 06:17:29 +00:00
Momtchil Momtchev
5a3f43b255 stream: fix regression on duplex end
Decide the return status of writeOrBuffer before
calling stream.write which can reset state.length

Add unit test for #35926

Refs: https://github.com/nodejs/node/issues/35926

PR-URL: https://github.com/nodejs/node/pull/35941
Fixes: https://github.com/nodejs/node/issues/35926
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-11-04 05:12:38 -08:00
Yash Ladha
364ac788e4 stream: remove redundant context from comments
Using the variable name in the comment and justifying the type seems
redundant to me and instead it should defined the entity which it is
acting, like in our case it is acting as a flag to control the flow in
streams.

PR-URL: https://github.com/nodejs/node/pull/35728
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
2020-10-25 17:41:21 +05:30
Yash Ladha
4d5444981a stream: fix duplicate logic in stream destroy
Fix duplicate logic in stream destroy as the same logic is being shared
across methods and thus can be encapsulated into a single method.

PR-URL: https://github.com/nodejs/node/pull/35727
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Ricky Zhou <0x19951125@gmail.com>
2020-10-24 12:57:21 +05:30
Robert Nagy
1d8ecd8cfe
stream: async iterator stop read if destroyed
Fixes some compatibility issues where it is expected
that for await stops reading when the stream is
destroyed.

Refs: https://github.com/nodejs/node/pull/34887

PR-URL: https://github.com/nodejs/node/pull/35640
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-10-15 15:46:40 -04:00
Michaël Zasso
1469984645 lib: use remaining typed arrays from primordials
PR-URL: https://github.com/nodejs/node/pull/35499
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Ujjwal Sharma <ryzokuken@disroot.org>
Reviewed-By: Shingo Inoue <leko.noor@gmail.com>
2020-10-07 13:44:21 +00:00
Michaël Zasso
a073f532da lib: use Number.parseInt from primordials
PR-URL: https://github.com/nodejs/node/pull/35499
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Ujjwal Sharma <ryzokuken@disroot.org>
Reviewed-By: Shingo Inoue <leko.noor@gmail.com>
2020-10-07 13:44:20 +00:00
Robert Nagy
6be80e1893 stream: fix legacy pipe error handling
Fixes: https://github.com/nodejs/node/issues/35237

PR-URL: https://github.com/nodejs/node/pull/35257
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-09-23 04:33:05 -07:00
Robert Nagy
2b9003b165 stream: don't destroy on async iterator success
Destroying on async iterator completion ignores autoDestroy.

PR-URL: https://github.com/nodejs/node/pull/35122
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-09-21 21:38:49 +00:00
Matteo Collina
9c62e0e384 stream: move to internal/streams
Move all the streams constructors to internal/streams
and avoid a circular dependencies between the modules.

See: https://github.com/nodejs/readable-stream/issues/348

PR-URL: https://github.com/nodejs/node/pull/35239
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
2020-09-21 08:23:06 +00:00
Denys Otrishko
c66e6471e7
lib: remove ERR_INVALID_OPT_VALUE and ERR_INVALID_OPT_VALUE_ENCODING
This will be a start to generalize all argument validation
errors. As currently we throw ARG/OPT, OUT_OF_RANGE, and other more
specific errors.
The OPT errors didn't bring much to the errors as it's just another
variant of ARG error which is sometimes more confusing (some of our code
used OPT errors to denote just argument validation errors presumably
because of similarity of OPT to 'option' and not 'options-object')
and they don't specify the name of the options object where the invalid
value is located. Much better approach would be to just specify path
to the invalid value in the name of the value as it is done in this PR
(i.e. 'options.format', 'options.publicKey.type' etc)

Also since this decreases a variety of errors we have it'd be easier to
reuse validation code across the codebase.

Refs: https://github.com/nodejs/node/pull/31251
Refs: https://github.com/nodejs/node/pull/34070#discussion_r467251009
Signed-off-by: Denys Otrishko <shishugi@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/34682
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-09-11 17:54:42 +03:00
James M Snell
744a284ccc stream: support async for stream impl functions
PR-URL: https://github.com/nodejs/node/pull/34416
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
2020-08-03 17:54:08 -07:00
Robert Nagy
02c4869bee stream: fix Duplex._construct race
Ensures that _construct has finished before invoking
_destroy.

The 'constructed' property was not properly set to false
for both writable and readable state.

Fixes: https://github.com/nodejs/node/issues/34448

PR-URL: https://github.com/nodejs/node/pull/34456
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2020-07-21 11:00:39 -07:00
Robert Nagy
08e8997d54 stream: simpler and faster Readable async iterator
Reimplement as an async generator instead of a custom
iterator class.

PR-URL: https://github.com/nodejs/node/pull/34035
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-07-17 09:06:27 +02:00
Robert Nagy
a55b77d2d3 stream: finished on closed OutgoingMessage
finished should invoke callback on closed OutgoingMessage the
same way as for regular streams.

Fixes: https://github.com/nodejs/node/issues/34301

PR-URL: https://github.com/nodejs/node/pull/34313
Fixes: https://github.com/nodejs/node/issues/34274
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2020-07-16 08:37:01 +02:00
rickyes
48404a179f
stream: rename opts to options
PR-URL: https://github.com/nodejs/node/pull/34339
Refs: https://nodejs.org/dist/latest-v14.x/docs/api/stream.html#stream_stream_finished_stream_options_callback
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-07-16 00:28:13 +02:00
Robert Nagy
6213fcee9b stream: save error in state
Useful for future PR's to resolve situations where e.g. finished()
is invoked on an already errored streams.

PR-URL: https://github.com/nodejs/node/pull/34103
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2020-07-01 18:22:56 +02:00
Robert Nagy
fb8cc72e73 stream: construct
Provide a standardized way of asynchronously creating and
initializing resources before performing any work.

Refs: https://github.com/nodejs/node/issues/29314

PR-URL: https://github.com/nodejs/node/pull/29656
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
2020-05-27 10:24:05 +02:00
Luigi Pinca
b533fb3508 tools: enable no-else-return lint rule
Refs: https://github.com/nodejs/node/pull/32644
Refs: https://github.com/nodejs/node/pull/32662

PR-URL: https://github.com/nodejs/node/pull/32667
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2020-05-16 06:42:16 +02:00
Robert Nagy
8607f9ec5c stream: make from read one at a time
Currently from will eagerly buffer up items
which means that errors are also eagerly
encountered and items which are buffer when
an error occurs will be discarded, which is
inconsistent with how generators work.

Fixes: https://github.com/nodejs/node/issues/29428

PR-URL: https://github.com/nodejs/node/pull/33201
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2020-05-06 22:39:33 +02:00
Robert Nagy
e10e292c5e stream: remove unused _transformState
_transformState is no longer used since Transform was
simplified.

Refs: https://github.com/nodejs/node/pull/32763

PR-URL: https://github.com/nodejs/node/pull/33105
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2020-04-30 16:01:52 +02:00
Robert Nagy
d84f131291 stream: fix stream.finished on Duplex
finished would incorrectly believe that a Duplex is already
closed if either the readable or writable side has completed.

Fixes: https://github.com/nodejs/node/issues/33130

PR-URL: https://github.com/nodejs/node/pull/33133
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2020-04-30 14:21:49 +02:00
Pranshu Srivastava
2cd79700c0 stream: add null check in Readable.from
Throws `ERR_STREAM_NULL_VALUES` error if a null value is passed to
`Readable.from`. Also added docs for the same.

Co-Authored-By: 扩散性百万甜面包 <himself65@outlook.com>
Fixes: https://github.com/nodejs/node/issues/32845
PR-URL: https://github.com/nodejs/node/pull/32873
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2020-04-29 09:41:31 +02:00
Robert Nagy
f64c640e66 stream: don't emit end after close
Readable stream could emit 'end' after 'close'.

PR-URL: https://github.com/nodejs/node/pull/33076
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-04-28 16:00:44 +02:00
Robert Nagy
c15a27cab3 stream: don't wait for close on legacy streams
Try to detect non standard streams and don't wait for
'close' on these. In particular if we detected
that destroyed is true before we expect it to be then
fallback to compat behavior.

Fixes: https://github.com/nodejs/node/issues/33050

PR-URL: https://github.com/nodejs/node/pull/33058
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Zeyu Yang <himself65@outlook.com>
2020-04-27 17:08:26 +02:00
Robert Nagy
f5c11a1a0a stream: don't emit finish after close
Writable stream could emit 'finish' after 'close'.

PR-URL: https://github.com/nodejs/node/pull/32933
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2020-04-27 16:43:58 +02:00
Robert Nagy
6419e59889 stream: pipeline should only destroy un-finished streams
This PR logically reverts https://github.com/nodejs/node/pull/31940
which has caused lots of unnecessary breakage in the ecosystem.

This PR also aligns better with the actual documented behavior:

`stream.pipeline()` will call `stream.destroy(err)` on all streams
except:
  * `Readable` streams which have emitted `'end'` or `'close'`.
  * `Writable` streams which have emitted `'finish'` or `'close'`.

The behavior introduced in https://github.com/nodejs/node/pull/31940
was much more aggressive in terms of destroying streams. This was
good for avoiding potential resources leaks however breaks some
common assumputions in legacy streams.

Furthermore, it makes the code simpler and removes some hacks.

Fixes: https://github.com/nodejs/node/issues/32954
Fixes: https://github.com/nodejs/node/issues/32955

PR-URL: https://github.com/nodejs/node/pull/32968
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Mathias Buus <mathiasbuus@gmail.com>
2020-04-23 19:50:29 +02:00
Robert Nagy
4eb1701edb stream: finished should complete with read-only Duplex
If passed a Duplex where readable or writable has been
explicitly disabled then don't assume 'close' will be
emitted.

Fixes: https://github.com/nodejs/node/issues/32965

PR-URL: https://github.com/nodejs/node/pull/32967
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Mathias Buus <mathiasbuus@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
2020-04-23 19:47:11 +02:00
Vadzim Zieńka
8a3fa32a1f stream: close iterator in Readable.from
Call iterator.return() if not all of its values are consumed.

Fixes: https://github.com/nodejs/node/issues/32842

PR-URL: https://github.com/nodejs/node/pull/32844
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Zeyu Yang <himself65@outlook.com>
2020-04-18 21:28:17 +02:00
Robert Nagy
15cc2b652b stream: update comment to indicate unused API
destroy w/ callback was previously used by node
core. This is no longer the case and the
comments should reflect this to avoid confusion.

PR-URL: https://github.com/nodejs/node/pull/32808
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2020-04-16 09:26:50 +02:00
Robert Nagy
98b6b2d840 stream: complete pipeline with stdio
stdio (stderr & stdout) should for compatibility
reasons not be closed/end():ed. However, this
causes pipeline with a stdio destination to
never finish. This commit fixes this issue at
a performance cost.

Refs: https://github.com/nodejs/node/issues/7606

Fixes: https://github.com/nodejs/node/issues/32363

PR-URL: https://github.com/nodejs/node/pull/32373
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2020-04-06 21:48:25 +02:00
Robert Nagy
1428a92492
stream: make pipeline try to wait for 'close'
Pipeline uses eos which will invoke the callback
on 'finish' and 'end' before all streams have been
fully destroyed.

Fixes: https://github.com/nodejs/node/issues/32032

PR-URL: https://github.com/nodejs/node/pull/32158
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-03-27 15:55:21 +01:00