diff --git a/lib/internal/quic/quic.js b/lib/internal/quic/quic.js index 6ad476eed5216f..c45923709ee26d 100644 --- a/lib/internal/quic/quic.js +++ b/lib/internal/quic/quic.js @@ -352,7 +352,7 @@ const onSessionHandshakeChannel = dc.channel('quic.session.handshake'); * @property {bigint|number} [maxConnectionsTotal] The maximum number of total connections * @property {bigint|number} [maxStatelessResetsPerHost] The maximum number of stateless resets per host * @property {bigint|number} [addressLRUSize] The size of the address LRU cache - * @property {bigint|number} [maxRetries] The maximum number of retriesw + * @property {bigint|number} [maxRetries] The maximum number of retries * @property {number} [rxDiagnosticLoss] The receive diagnostic loss probability (range 0.0-1.0) * @property {number} [txDiagnosticLoss] The transmit diagnostic loss probability (range 0.0-1.0) * @property {number} [udpReceiveBufferSize] The UDP receive buffer size @@ -507,7 +507,7 @@ setCallbacks({ if (session.destroyed) { stream.destroy(); return; - }; + } session[kNewStream](stream, direction); }, @@ -1383,29 +1383,21 @@ class QuicSession { debug('finishing closing the session with an error', errorType, code, reason); // Otherwise, errorType indicates the type of error that occurred, code indicates // the specific error, and reason is an optional string describing the error. + // Note: code is guaranteed to be non-zero here due to early return above switch (errorType) { case 0: /* Transport Error */ - if (code === 0n) { - this.destroy(); - } else { - this.destroy(new ERR_QUIC_TRANSPORT_ERROR(code, reason)); - } + this.destroy(new ERR_QUIC_TRANSPORT_ERROR(code, reason)); break; case 1: /* Application Error */ - if (code === 0n) { - this.destroy(); - } else { - this.destroy(new ERR_QUIC_APPLICATION_ERROR(code, reason)); - } + this.destroy(new ERR_QUIC_APPLICATION_ERROR(code, reason)); break; case 2: /* Version Negotiation Error */ this.destroy(new ERR_QUIC_VERSION_NEGOTIATION_ERROR()); break; - case 3: /* Idle close */ { + case 3: /* Idle close */ // An idle close is not really an error. We can just destroy. this.destroy(); break; - } } }