diff options
author | James M Snell <jasnell@gmail.com> | 2020-07-11 03:10:50 +0300 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2020-07-16 03:17:04 +0300 |
commit | ed4882241cf6fd82c280f916549e56699a3ee1dc (patch) | |
tree | 5ed991a28d76b2f1f776a2f8ef1f63c11258ec0b /lib/internal/quic | |
parent | 57c1129508092d50ff12759360f85ff681d83574 (diff) |
quic: properly pass readable/writable constructor options
PR-URL: https://github.com/nodejs/node/pull/34283
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'lib/internal/quic')
-rw-r--r-- | lib/internal/quic/core.js | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/lib/internal/quic/core.js b/lib/internal/quic/core.js index e412d044200..6bc784ad0db 100644 --- a/lib/internal/quic/core.js +++ b/lib/internal/quic/core.js @@ -472,21 +472,11 @@ function onStreamReady(streamHandle, id, push_id) { // state because new streams should not have been accepted at the C++ // level. assert(!session.closing); - - // TODO(@jasnell): Get default options from session - const uni = id & 0b10; - const { - highWaterMark, - defaultEncoding, - } = session[kStreamOptions]; const stream = new QuicStream({ - writable: !uni, - highWaterMark, - defaultEncoding, + ...session[kStreamOptions], + writable: !(id & 0b10), }, session, push_id); stream[kSetHandle](streamHandle); - if (uni) - stream.end(); session[kAddStream](id, stream); process.nextTick(emit.bind(session, 'stream', stream)); } @@ -2145,12 +2135,6 @@ class QuicSession extends EventEmitter { readable: !halfOpen }, this); - // TODO(@jasnell): This really shouldn't be necessary - if (halfOpen) { - stream.push(null); - stream.read(); - } - state.pendingStreams.add(stream); // If early data is being used, we can create the internal QuicStream on the @@ -2516,7 +2500,7 @@ class QuicClientSession extends QuicSession { } function streamOnResume() { - if (!this.destroyed) + if (!this.destroyed && this.readable) this[kHandle].readStart(); } @@ -2546,9 +2530,13 @@ class QuicStream extends Duplex { const { highWaterMark, defaultEncoding, + readable = true, + writable = true, } = options; super({ + readable, + writable, highWaterMark, defaultEncoding, allowHalfOpen: true, @@ -2996,10 +2984,6 @@ class QuicStream extends Duplex { defaultEncoding, }, this.session); - // TODO(@jasnell): The null push and subsequent read shouldn't be necessary - stream.push(null); - stream.read(); - stream[kSetHandle](handle); this.session[kAddStream](stream.id, stream); return stream; |