mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
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>
This commit is contained in:
1 parent
de85b1ea95
commit
a5dec3a470
2 files changed
+6
-4
No files matched your search
@@ -43,7 +43,7 @@ const { Stream, prependListener } = require('internal/streams/legacy');
|
||||
const { Buffer } = require('buffer');
|
||||
|
||||
const {
|
||||
addAbortSignalNoValidate,
|
||||
addAbortSignal,
|
||||
} = require('internal/streams/add-abort-signal');
|
||||
const eos = require('internal/streams/end-of-stream');
|
||||
|
||||
@@ -199,8 +199,9 @@ function Readable(options) {
|
||||
|
||||
if (typeof options.construct === 'function')
|
||||
this._construct = options.construct;
|
||||
|
||||
if (options.signal && !isDuplex)
|
||||
addAbortSignalNoValidate(options.signal, this);
|
||||
addAbortSignal(options.signal, this);
|
||||
}
|
||||
|
||||
Stream.call(this, options);
|
||||
|
||||
@@ -46,7 +46,7 @@ const { Buffer } = require('buffer');
|
||||
const destroyImpl = require('internal/streams/destroy');
|
||||
|
||||
const {
|
||||
addAbortSignalNoValidate,
|
||||
addAbortSignal,
|
||||
} = require('internal/streams/add-abort-signal');
|
||||
|
||||
const {
|
||||
@@ -249,8 +249,9 @@ function Writable(options) {
|
||||
|
||||
if (typeof options.construct === 'function')
|
||||
this._construct = options.construct;
|
||||
|
||||
if (options.signal)
|
||||
addAbortSignalNoValidate(options.signal, this);
|
||||
addAbortSignal(options.signal, this);
|
||||
}
|
||||
|
||||
Stream.call(this, options);
|
||||
|
||||
Reference in new issue
Block a user