diff --git a/lib/internal/quic/core.js b/lib/internal/quic/core.js index 257ffb2b2b02d4..f559e040febd92 100644 --- a/lib/internal/quic/core.js +++ b/lib/internal/quic/core.js @@ -12,7 +12,6 @@ assertCrypto(); const { Array, BigInt64Array, - Boolean, Error, Map, RegExp, @@ -30,7 +29,6 @@ const { setTransportParams, toggleListeners, validateNumber, - validateCloseCode, validateTransportParams, validateQuicClientSessionOptions, validateQuicSocketOptions, @@ -98,7 +96,6 @@ const { codes: { ERR_INVALID_ARG_TYPE, ERR_INVALID_CALLBACK, - ERR_QUIC_ERROR, ERR_QUICSESSION_DESTROYED, ERR_QUICSESSION_VERSION_NEGOTIATION, ERR_QUICSOCKET_DESTROYED, @@ -1888,7 +1885,7 @@ class QuicSession extends EventEmitter { this.removeListener('removeListener', onRemoveListener); const handle = this[kHandle]; - this[kHandle] = undefined + this[kHandle] = undefined; if (handle !== undefined) { // Copy the stats for use after destruction state.stats = new BigInt64Array(handle.stats); diff --git a/lib/internal/quic/util.js b/lib/internal/quic/util.js index b5a6e8ed690718..143ee4dd8cef80 100644 --- a/lib/internal/quic/util.js +++ b/lib/internal/quic/util.js @@ -1,6 +1,8 @@ 'use strict'; const { + Boolean, + Number, NumberINFINITY, NumberNEGATIVE_INFINITY, } = primordials; @@ -21,18 +23,15 @@ const { }, } = require('internal/async_hooks'); -const { - kHandle, -} = require('internal/stream_base_commons'); - -const endianness = require('os').endianness(); - const { Readable } = require('stream'); const { + kHandle, kUpdateTimer, onStreamRead, } = require('internal/stream_base_commons'); +const endianness = require('os').endianness(); + const assert = require('internal/assert'); assert(process.versions.ngtcp2 !== undefined); @@ -874,26 +873,26 @@ class QuicSessionSharedState { get maxStreamsBidi() { return Number(endianness === 'BE' ? - this[kHandle].readBigInt64BE(IDX_QUICSESSION_STATE_MAX_STREAMS_BIDI) : - this[kHandle].readBigInt64LE(IDX_QUICSESSION_STATE_MAX_STREAMS_BIDI)); + this[kHandle].readBigInt64BE(IDX_QUICSESSION_STATE_MAX_STREAMS_BIDI) : + this[kHandle].readBigInt64LE(IDX_QUICSESSION_STATE_MAX_STREAMS_BIDI)); } get maxStreamsUni() { return Number(endianness === 'BE' ? - this[kHandle].readBigInt64BE(IDX_QUICSESSION_STATE_MAX_STREAMS_UNI) : - this[kHandle].readBigInt64LE(IDX_QUICSESSION_STATE_MAX_STREAMS_UNI)); + this[kHandle].readBigInt64BE(IDX_QUICSESSION_STATE_MAX_STREAMS_UNI) : + this[kHandle].readBigInt64LE(IDX_QUICSESSION_STATE_MAX_STREAMS_UNI)); } get maxDataLeft() { return Number(endianness === 'BE' ? - this[kHandle].readBigInt64BE(IDX_QUICSESSION_STATE_MAX_DATA_LEFT) : - this[kHandle].readBigInt64LE(IDX_QUICSESSION_STATE_MAX_DATA_LEFT)); + this[kHandle].readBigInt64BE(IDX_QUICSESSION_STATE_MAX_DATA_LEFT) : + this[kHandle].readBigInt64LE(IDX_QUICSESSION_STATE_MAX_DATA_LEFT)); } get bytesInFlight() { return Number(endianness === 'BE' ? - this[kHandle].readBigInt64BE(IDX_QUICSESSION_STATE_BYTES_IN_FLIGHT) : - this[kHandle].readBigInt64LE(IDX_QUICSESSION_STATE_BYTES_IN_FLIGHT)); + this[kHandle].readBigInt64BE(IDX_QUICSESSION_STATE_BYTES_IN_FLIGHT) : + this[kHandle].readBigInt64LE(IDX_QUICSESSION_STATE_BYTES_IN_FLIGHT)); } } diff --git a/src/quic/node_quic_session.h b/src/quic/node_quic_session.h index ef9948f235823b..9cbaa317ae5876 100644 --- a/src/quic/node_quic_session.h +++ b/src/quic/node_quic_session.h @@ -837,8 +837,10 @@ class QuicSession : public AsyncWrap, #define V(id, name) \ bool is_##name() const { return flags_ & (1 << QUICSESSION_FLAG_##id); } \ void set_##name(bool on = true) { \ - if (on) flags_ |= (1 << QUICSESSION_FLAG_##id); \ - else flags_ &= ~(1 << QUICSESSION_FLAG_##id); \ + if (on) \ + flags_ |= (1 << QUICSESSION_FLAG_##id); \ + else \ + flags_ &= ~(1 << QUICSESSION_FLAG_##id); \ } QUICSESSION_FLAGS(V) #undef V diff --git a/test/parallel/test-quic-maxconnectionsperhost.js b/test/parallel/test-quic-maxconnectionsperhost.js index 1bfbb7b8e790ea..b94849b88272c3 100644 --- a/test/parallel/test-quic-maxconnectionsperhost.js +++ b/test/parallel/test-quic-maxconnectionsperhost.js @@ -77,8 +77,8 @@ const kALPN = 'zzz'; countdown.dec(); // Shutdown the remaining open sessions. setImmediate(common.mustCall(() => { - for (const req of sessions) - req.close(); + for (const req of sessions) + req.close(); })); })); diff --git a/test/parallel/test-quic-qlog.js b/test/parallel/test-quic-qlog.js index 692b90436fe84a..03c537062813dd 100644 --- a/test/parallel/test-quic-qlog.js +++ b/test/parallel/test-quic-qlog.js @@ -70,7 +70,9 @@ function gatherQlog(session, id) { switch (id) { case 'server': setupQlog(session.qlog); + break; case 'client': session.on('qlog', setupQlog); + break; } }