From a74252896824ca5b79a5e3c8d65c473eba23dadf Mon Sep 17 00:00:00 2001 From: CDeltakai Date: Fri, 16 May 2025 13:32:33 +1000 Subject: [PATCH 1/2] fix: removed unnecessary variable and 1 --- src/QUICStream.ts | 2 +- tests/QUICStream.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/QUICStream.ts b/src/QUICStream.ts index cb979c19..5d842137 100644 --- a/src/QUICStream.ts +++ b/src/QUICStream.ts @@ -577,7 +577,7 @@ class QUICStream implements ReadableWritablePair { this.rejectReadableP = rejectReadableP; try { await readableP; - } catch (e) { + } catch { // If readableP was rejected then we just want to end early here, // anything rejecting it should already have errored the stream. return; diff --git a/tests/QUICStream.test.ts b/tests/QUICStream.test.ts index 3320c5f7..9f445bad 100644 --- a/tests/QUICStream.test.ts +++ b/tests/QUICStream.test.ts @@ -12,7 +12,7 @@ import * as utils from '#utils.js'; import QUICServer from '#QUICServer.js'; import QUICClient from '#QUICClient.js'; import QUICStream from '#QUICStream.js'; -1; + describe(QUICStream.name, () => { const logger = new Logger(`${QUICStream.name} Test`, LogLevel.WARN, [ new StreamHandler( From f221c37aaaca4a259c79e5c8030e09b4f9998639 Mon Sep 17 00:00:00 2001 From: CDeltakai Date: Fri, 16 May 2025 14:08:29 +1000 Subject: [PATCH 2/2] refactor: split destructuring for host_ in QUICClient and QUICSocket to silence linter error --- src/QUICClient.ts | 3 ++- src/QUICSocket.ts | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/QUICClient.ts b/src/QUICClient.ts index 2c7098a3..b2a9aa98 100644 --- a/src/QUICClient.ts +++ b/src/QUICClient.ts @@ -141,12 +141,13 @@ class QUICClient { await crypto.ops.randomBytes(scidBuffer); const scid = new QUICConnectionId(scidBuffer); // Validating host and port types - let [host_, udpType] = await utils.resolveHost(host, resolveHostname); + const [tmpHost, udpType] = await utils.resolveHost(host, resolveHostname); const port_ = utils.toPort(port); // If the target host is in fact a zero IP, it cannot be used // as a target host, so we need to resolve it to a non-zero IP // in this case, 0.0.0.0 is resolved to 127.0.0.1 and :: and ::0 is // resolved to ::1. + let host_ = tmpHost; host_ = utils.resolvesZeroIP(host_); let isSocketShared: boolean; if (socket == null) { diff --git a/src/QUICSocket.ts b/src/QUICSocket.ts index 90c55d6f..64711015 100644 --- a/src/QUICSocket.ts +++ b/src/QUICSocket.ts @@ -396,7 +396,11 @@ class QUICSocket { ); } const host = params[index] as Host | Hostname; - let [host_, udpType] = await utils.resolveHost(host, this.resolveHostname); + const [tmpHost, udpType] = await utils.resolveHost( + host, + this.resolveHostname, + ); + let host_ = tmpHost; host_ = utils.resolvesZeroIP(host_); host_ = utils.validateTarget( this._host,