From ee7e2e588acb5d8e9d614ac5ec4af51427444a98 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Thu, 9 Jul 2020 13:22:06 -0700 Subject: [PATCH] quic: use a getter for stream options Doesn't need to be a function PR-URL: https://github.com/nodejs/node/pull/34283 Reviewed-By: Anna Henningsen --- lib/internal/quic/core.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/internal/quic/core.js b/lib/internal/quic/core.js index 04ff53e6a4483e..bbddf0851d0c48 100644 --- a/lib/internal/quic/core.js +++ b/lib/internal/quic/core.js @@ -214,7 +214,6 @@ const kContinueBind = Symbol('kContinueBind'); const kDestroy = Symbol('kDestroy'); const kEndpointBound = Symbol('kEndpointBound'); const kEndpointClose = Symbol('kEndpointClose'); -const kGetStreamOptions = Symbol('kGetStreamOptions'); const kHandshake = Symbol('kHandshake'); const kHandshakePost = Symbol('kHandshakePost'); const kHeaders = Symbol('kHeaders'); @@ -237,6 +236,7 @@ const kSetSocket = Symbol('kSetSocket'); const kSetSocketAfterBind = Symbol('kSetSocketAfterBind'); const kStartFilePipe = Symbol('kStartFilePipe'); const kStreamClose = Symbol('kStreamClose'); +const kStreamOptions = Symbol('kStreamOptions'); const kStreamReset = Symbol('kStreamReset'); const kTrackWriteState = Symbol('kTrackWriteState'); const kUDPHandleForTesting = Symbol('kUDPHandleForTesting'); @@ -277,7 +277,7 @@ function onSessionReady(handle) { new QuicServerSession( socket, handle, - socket[kGetStreamOptions]()); + socket[kStreamOptions]); try { socket.emit('session', session); } catch (error) { @@ -475,7 +475,7 @@ function onStreamReady(streamHandle, id, push_id) { const { highWaterMark, defaultEncoding, - } = session[kGetStreamOptions](); + } = session[kStreamOptions]; const stream = new QuicStream({ writable: !uni, highWaterMark, @@ -965,7 +965,7 @@ class QuicSocket extends EventEmitter { // Returns the default QuicStream options for peer-initiated // streams. These are passed on to new client and server // QuicSession instances when they are created. - [kGetStreamOptions]() { + get [kStreamOptions]() { const state = this[kInternalState]; return { highWaterMark: state.highWaterMark, @@ -1685,9 +1685,9 @@ class QuicSession extends EventEmitter { socket[kAddSession](this); } - // kGetStreamOptions is called to get the configured options - // for peer initiated QuicStream instances. - [kGetStreamOptions]() { + // Used to get the configured options for peer initiated QuicStream + // instances. + get [kStreamOptions]() { const state = this[kInternalState]; return { highWaterMark: state.highWaterMark,