Michaël Zasso
1f9a5ae7aa
lib: use static Number properties from primordials
...
PR-URL: https://github.com/nodejs/node/pull/30686
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2019-11-30 13:45:38 +01:00
Michaël Zasso
141a6e34ee
lib: enforce use of Array from primordials
...
PR-URL: https://github.com/nodejs/node/pull/30635
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2019-11-27 19:29:01 +01:00
Michaël Zasso
0646eda4fc
lib: flatten access to primordials
...
Store all primordials as properties of the primordials object.
Static functions are prefixed by the constructor's name and prototype
methods are prefixed by the constructor's name followed by "Prototype".
For example: primordials.Object.keys becomes primordials.ObjectKeys.
PR-URL: https://github.com/nodejs/node/pull/30610
Refs: https://github.com/nodejs/node/issues/29766
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2019-11-25 10:28:15 +01:00
Robert Nagy
f8c069f5b8
stream: increase MAX_HWM
...
MAX_HWM was added in 9208c89 where the highwatermark was changed to
always increase in steps of highest power of 2 to prevent increasing
hwm excessivly in tiny amounts.
Why a limit was added on the highwatermark is unclear but breaks
existing usage where a larger read size is used. The invariant for
read(n) is that a buffer of size n is always returned. Considering
a maximum ceiling on the buffer size breaks this invariant.
This PR significantly increases the limit to make it less likely to
break the previous invariant and also documents the limit.
Fixes: https://github.com/nodejs/node/issues/29933
PR-URL: https://github.com/nodejs/node/pull/29938
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2019-11-11 19:50:40 -08:00
Matteo Collina
009952935f
stream: extract Readable.from in its own file
...
See: https://github.com/nodejs/readable-stream/pull/420
PR-URL: https://github.com/nodejs/node/pull/30140
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com >
2019-10-29 09:36:24 +01:00
Robert Nagy
f8f6a21580
stream: throw unhandled error for readable with autoDestroy
...
If autoDestroy then we should still throw on unhandled
errors.
PR-URL: https://github.com/nodejs/node/pull/29806
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
Co-Authored-By: Trivikram Kamat <trivikr.dev@gmail.com >
2019-10-13 16:38:15 -07:00
ZYSzys
739f113ba6
lib: introduce no-mixed-operators eslint rule to lib
...
PR-URL: https://github.com/nodejs/node/pull/29834
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2019-10-05 13:59:32 -07:00
Robert Nagy
1665a9330c
stream: apply special logic in removeListener for readable.off()
...
We have special logic in removeListener() which must apply
to off() as well.
PR-URL: https://github.com/nodejs/node/pull/29486
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: Luigi Pinca <luigipinca@gmail.com >
2019-09-22 18:05:54 -07:00
Robert Nagy
ec390b63a1
stream: do not call _read() after destroy()
...
PR-URL: https://github.com/nodejs/node/pull/29491
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Minwoo Jung <minwoo@nodesource.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
2019-09-22 15:55:15 -07:00
Robert Nagy
bd02775af8
stream: optimize creation
...
PR-URL: https://github.com/nodejs/node/pull/29135
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
2019-09-22 21:46:58 +08:00
ran
698a29420f
stream: fix readable state awaitDrain increase in recursion
...
PR-URL: https://github.com/nodejs/node/pull/27572
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2019-08-26 15:20:50 +02:00
Robert Nagy
317fa3a757
stream: add readableEnded
...
Adds a readableEnded property and improved finished compat with possible
stream-like objects.
PR-URL: https://github.com/nodejs/node/pull/28814
Refs: https://github.com/nodejs/node/issues/28813
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-08-19 22:03:07 -07:00
Robert Nagy
ea765eba20
stream: simplify howMuchToRead()
...
This slightly refactors read by moving side effects out of
howMuchToRead().
We don't actually have to set state.needReadable = true; in
howMuchToRead() since read handles 0 return as needReadable.
PR-URL: https://github.com/nodejs/node/pull/29155
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-08-19 20:14:17 -07:00
Robert Nagy
4a2bd69db9
stream: fix destroy() behavior
...
Ensure errorEmitted is always set. Only emit 'error' once.
PR-URL: https://github.com/nodejs/node/pull/29058
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-08-16 21:33:53 -07:00
Robert Nagy
7195cd6fb3
stream: use lazy registration for drain for fast destinations
...
PR-URL: https://github.com/nodejs/node/pull/29095
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-08-16 16:01:43 -07:00
Robert Nagy
c15b4969e9
stream: encapsulate buffer-list
...
PR-URL: https://github.com/nodejs/node/pull/28974
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-08-09 11:11:53 -07:00
Matteo Collina
147b9d9792
stream: resolve perf regression introduced by V8 7.3
...
This commit contains two fixes:
1. use instanceof instead of Object.getPrototypeOf, as checking an
object prototype with Object.getPrototypeOf is slower
than an instanceof check.
2. avoid parseInt(undefined, 10) to get NaN as it regressed.
PR-URL: https://github.com/nodejs/node/pull/28842
Fixes: https://github.com/nodejs/node/issues/28586
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-07-26 21:58:09 -07:00
ZYSzys
6c430b48b9
stream: use readableEncoding public api for child_process
...
PR-URL: https://github.com/nodejs/node/pull/28548
Refs: https://github.com/nodejs/node/issues/445
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-07-14 22:27:33 -07:00
Weijia Wang
824dc576db
stream: simplify .pipe() and .unpipe() in Readable
...
Now we are using `pipes` and `pipesCount` in Readable state and the
`pipes` value can be a stream or an array of streams. This change
reducing them into one `pipes` value, which is an array of streams.
PR-URL: https://github.com/nodejs/node/pull/28583
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2019-07-15 00:19:51 +02:00
Marcos Casagrande
df339bccf2
stream: convert string to Buffer when calling unshift(<string>)
...
`readable.unshift` can take a string as an argument, but that
string wasn't being converted to a Buffer, which caused a
<TypeError: Argument must be a buffer> in some cases. Also if a
string was passed, that string was coerced to utf8 encoding.
A second optional argument `encoding` was added to `unshift` to
fix the encoding issue.
Fixes: https://github.com/nodejs/node/issues/27192
PR-URL: https://github.com/nodejs/node/pull/27194
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-06-02 16:56:13 +02:00
Anna Henningsen
afb84744c6
stream: convert existing buffer when calling .setEncoding
...
Convert already-stored chunks when `.setEncoding()` is called
so that subsequent `data` events will receive decoded strings,
as they expect.
Fixes: https://github.com/nodejs/node/issues/27932
PR-URL: https://github.com/nodejs/node/pull/27936
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-05-30 14:35:29 +02:00
Anto Aravinth
b4735ecebb
stream: use readableObjectMode public api for js stream
...
PR-URL: https://github.com/nodejs/node/pull/27655
Refs: https://github.com/nodejs/node/issues/445
Reviewed-By: James M Snell <jasnell@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: Yongsheng Zhang <zyszys98@gmail.com >
2019-05-19 23:37:51 +02:00
Guy Bedford
030fa2ea44
stream: implement Readable.from async iterator utility
...
PR-URL: https://github.com/nodejs/node/pull/27660
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2019-05-18 09:15:01 +02:00
Joyee Cheung
2e4ceb5747
util: access process states lazily in debuglog
...
`debuglog()` depends on `process.pid` and `process.env.NODE_DEBUG`,
so it needs to be called lazily in top scopes of internal modules
that may be loaded before these run time states are allowed to
be accessed. This patch makes its implementation lazy by default,
the process states are only accessed when the returned debug
function is called for the first time.
PR-URL: https://github.com/nodejs/node/pull/27281
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
2019-04-20 00:30:38 +08:00
Michaël Zasso
908292cf1f
lib: enforce the use of Object from primordials
...
PR-URL: https://github.com/nodejs/node/pull/27146
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
2019-04-12 05:38:45 +02:00
Marcos Casagrande
1a67c9948c
stream: remove dead code
...
Remove unreachable code. `state.ended` is always set to true
in this part of the code. The `else` clause can't be executed.
PR-URL: https://github.com/nodejs/node/pull/27125
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2019-04-10 23:40:39 +02:00
Matteo Collina
1d8298a5b6
stream: make Symbol.asyncIterator support stable
...
PR-URL: https://github.com/nodejs/node/pull/26989
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Masashi Hirano <shisama07@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2019-04-03 09:15:59 +02:00
Anna Henningsen
20c3ac2556
stream: do not unconditionally call _read() on resume()
...
`readable.resume()` calls `.read(0)`, which in turn previously set
`needReadable = true`, and so a subsequent `.read()` call would
call `_read()` even though enough data was already available.
This can lead to elevated memory usage, because calling `_read()`
when enough data is in the readable buffer means that backpressure
is not being honoured.
Fixes: https://github.com/nodejs/node/issues/26957
PR-URL: https://github.com/nodejs/node/pull/26965
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2019-03-31 14:09:35 +02:00
Ruben Bridgewater
f86f5736da
benchmark,lib: change var to const
...
Refs: https://github.com/nodejs/node/pull/26679
PR-URL: https://github.com/nodejs/node/pull/26915
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Refael Ackermann <refack@gmail.com >
2019-03-30 13:16:39 +01:00
Ruben Bridgewater
b08a867d60
benchmark,doc,lib: capitalize more comments
...
PR-URL: https://github.com/nodejs/node/pull/26849
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
2019-03-27 17:20:06 +01:00
Ruben Bridgewater
39f4158bc3
lib: move extra properties into error creation
...
This encapsulates the Node.js errors more by adding extra properties
to an error inside of the function to create the error message instead
of adding the properties at the call site. That simplifies the usage
of our errors and makes sure the expected properties are always set.
PR-URL: https://github.com/nodejs/node/pull/26752
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-03-21 22:52:08 +01:00
Weijia Wang
c8d3a73c8b
lib: use Array#includes instead of Array#indexOf
...
PR-URL: https://github.com/nodejs/node/pull/26732
Refs: https://github.com/nodejs/node/issues/26568
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2019-03-21 21:38:02 +08:00
Matteo Collina
269103a0e5
stream: fix regression introduced in #26059
...
In #26059 , we introduced a bug that caused 'readable' to be nextTicked
on EOF of a ReadableStream. This breaks the dicer module on CITGM.
That change was partially reverted to still fix the bug in #25810 and
not break dicer.
See: https://github.com/nodejs/node/pull/26059
Fixes: https://github.com/nodejs/node/issues/25810
PR-URL: https://github.com/nodejs/node/pull/26643
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-03-16 11:58:12 +01:00
Ruben Bridgewater
f8763bb077
benchmark,doc,lib,test: capitalize comments
...
PR-URL: https://github.com/nodejs/node/pull/26483
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2019-03-10 00:44:40 +01:00
Joyee Cheung
b05fd4baa8
lib: explicitly initialize debuglog during bootstrap
...
This patch splits the implementation of util.debuglog into a
separate file and explicitly initialize it during pre-execution
since the initialization depends on environment variables.
Also delays the call to `debuglog` in modules that are loaded during
bootstrap to make sure we only access the environment variable
during pre-execution.
PR-URL: https://github.com/nodejs/node/pull/26468
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2019-03-08 13:57:38 +01:00
Matteo Collina
e95e7f9af5
stream: make sure 'readable' is emitted before ending the stream
...
Fixes: https://github.com/nodejs/node/issues/25810
PR-URL: https://github.com/nodejs/node/pull/26059
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2019-03-06 08:38:29 +00:00
Ruben Bridgewater
9edce1e12a
benchmark,doc,lib,test: capitalize comments
...
This updates a lot of comments.
PR-URL: https://github.com/nodejs/node/pull/26223
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com >
2019-02-28 18:31:10 +01:00
Matteo Collina
cd302d70dd
stream: make _read() be called indefinitely if the user wants so
...
Fixes: https://github.com/nodejs/node/issues/26097
PR-URL: https://github.com/nodejs/node/pull/26135
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2019-02-28 16:12:26 +01:00
Ruben Bridgewater
50dd555910
doc,lib,test: capitalize comment sentences
...
This activates the eslint capitalize comment rule for comments
above 50 characters.
PR-URL: https://github.com/nodejs/node/pull/24996
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-12-17 17:14:35 +01:00
Mikko Rantanen
37a5e01bda
lib: ensure readable stream flows to end
...
If a readable stream was set up with `highWaterMark 0`, the while-loop
in `maybeReadMore_` function would never execute.
The while loop now has an extra or-condition for the case where the
stream is flowing and there are no items. The or-condition is adapted
from the emit-condition of the `addChunk` function.
The `addChunk` also contains a check for `state.sync`. However that part
of the check was omitted here because the `maybeReadMore_` is executed
using `process.nextTick`. `state.sync` is set and then unset within the
`read()` function so it should never be in effect in `maybeReadMore_`.
Fixes: https://github.com/nodejs/node/issues/24915
PR-URL: https://github.com/nodejs/node/pull/24918
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2018-12-14 09:23:56 -08:00
Ruben Bridgewater
1f85ea979c
tools: capitalize sentences
...
This adds the `capitalized-comments` eslint rule to verify that
actual sentences use capital letters as starting letters. It ignores
special words and all lines below 62 characters.
PR-URL: https://github.com/nodejs/node/pull/24808
Reviewed-By: Sam Ruby <rubys@intertwingly.net >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
2018-12-10 17:07:18 +01:00
Ruben Bridgewater
59257543c3
lib: use ES6 class inheritance style
...
PR-URL: https://github.com/nodejs/node/pull/24755
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2018-12-05 16:55:00 +01:00
Ruben Bridgewater
dcc82b37b6
lib: remove inherits() usage
...
This switches all `util.inherits()` calls to use
`Object.setPrototypeOf()` instead. In fact, `util.inherits()` is
mainly a small wrapper around exactly this function while adding
the `_super` property on the object as well.
Refs: #24395
PR-URL: https://github.com/nodejs/node/pull/24755
Refs: https://github.com/nodejs/node/issues/24395
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2018-12-05 16:53:58 +01:00
Matteo Collina
69cc58d0ab
stream: correctly pause and resume after once('readable')
...
Fixes: https://github.com/nodejs/node/issues/24281
PR-URL: https://github.com/nodejs/node/pull/24366
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
2018-11-21 12:16:47 +01:00
Mathias Buus
f24b070cb7
stream: add auto-destroy mode
...
PR-URL: https://github.com/nodejs/node/pull/22795
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
2018-10-30 15:17:40 +01:00
Gus Caplan
8bce9e8f19
streams: refactor ReadableStream asyncIterator creation and a few fixes
...
Closes: https://github.com/nodejs/node/issues/23041
- Rewrite `ReadableAsyncIterator` class into
`ReadableStreamAsyncIteratorPrototype` which contains no constructor and
inherits from `%AsyncIteratorPrototype%`.
- Rewrite `AsyncIteratorRecord` into dumb function.
PR-URL: https://github.com/nodejs/node/pull/23042
Fixes: https://github.com/nodejs/node/issues/23041
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-10-08 22:17:29 -05:00
MaleDong
9c6f59ed3a
lib: remove unnecessary symbols
...
Remove `(...)`, because this is a simple,sensitive expression.
PR-URL: https://github.com/nodejs/node/pull/22455
Reviewed-By: Weijia Wang <starkwang@126.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-09-13 10:51:12 +02:00
Daniel Bevenius
0e519b4f56
stream: update emit readable debug statement
...
Currently, the debug statement in emitReadable is `emit readable` which
can be interpreted as the readable event is going to be emitted. But
I think the intent of this debug statment is just that the
emitReadable_ function was entered. If that was not the intent then
perhaps the debug statment should be moved into the if statement below
it.
PR-URL: https://github.com/nodejs/node/pull/22613
Reviewed-By: Denys Otrishko <shishugi@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2018-09-03 10:01:37 +02:00
Matteo Collina
98cf84f2c9
stream: restore flow if there are 'data' handlers after once('readable')
...
Fixes: https://github.com/nodejs/node/issues/21398
See: https://github.com/nodejs/node/pull/21696
PR-URL: https://github.com/nodejs/node/pull/22209
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Mathias Buus <mathiasbuus@gmail.com >
2018-08-21 22:36:13 -07:00
Denys Otrishko
fe47b8b6a5
stream: fix readable behavior for highWaterMark === 0
...
Avoid trying to emit 'readable' due to the fact that
state.length is always >= state.highWaterMark if highWaterMark is 0.
Therefore upon .read(0) call (through .on('readable')) stream assumed
that it has enough data to emit 'readable' even though
state.length === 0 instead of issuing _read(). Which led to the TTY
not recognizing that someone is waiting for the input.
Fixes: https://github.com/nodejs/node/issues/20503
Refs: https://github.com/nodejs/node/pull/18372
PR-URL: https://github.com/nodejs/node/pull/21690
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-08-10 17:16:59 +02:00