Commit 95ae1c8d501 for nodejs
commit 95ae1c8d5014678da06300292e06c85dd7b18ea1
Author: Marten Richter <marten.richter@tu-berlin.de>
Date: Thu Dec 3 17:02:33 2026 +0100
quic: drop promise arg for sendDatagram
This drops the promise type for the datagram in
sendDatagram. This allows sendDatagram to become
sync.
Fixes: #67871
Signed-off-by: Marten Richter <marten.richter@freenet.de>
PR-URL: https://github.com/nodejs/node/pull/67931
Fixes: https://github.com/nodejs/node/issues/67871
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
Reviewed-By: Efe Karasakal <hi@efe.dev>
Reviewed-By: Tim Perry <pimterry@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
diff --git a/doc/api/quic.md b/doc/api/quic.md
index 234be7238cf..1cf4f86c247 100644
--- a/doc/api/quic.md
+++ b/doc/api/quic.md
@@ -1470,10 +1470,10 @@ only.
added: v23.8.0
-->
-* `datagram` {string|ArrayBufferView|Promise}
+* `datagram` {string|ArrayBufferView}
* `encoding` {string} The encoding to use if `datagram` is a string.
**Default:** `'utf8'`.
-* Returns: {Promise} for a {bigint} datagram ID.
+* Returns: a {bigint} datagram ID.
Sends an unreliable datagram to the remote peer, returning a promise for
the datagram ID.
@@ -1487,10 +1487,6 @@ their source cannot be mutated after the call (for example, when handing
the buffer off to another async consumer) can call
`ArrayBuffer.prototype.transfer()` themselves before passing the buffer.
-If `datagram` is a `Promise`, it will be awaited before sending. If the
-session closes while awaiting, `0n` is returned silently (datagrams are
-inherently unreliable).
-
If the datagram payload is zero-length (empty string after encoding, detached
buffer, or zero-length view), `0n` is returned and no datagram is sent.
diff --git a/lib/internal/quic/quic.js b/lib/internal/quic/quic.js
index 204b49b1dfb..729000fdd93 100644
--- a/lib/internal/quic/quic.js
+++ b/lib/internal/quic/quic.js
@@ -3330,14 +3330,11 @@ class QuicSession {
* mutated after the call (for example, when handing the buffer off to
* another async consumer) can call ArrayBuffer.prototype.transfer()
* themselves before passing it.
- *
- * If a Promise is given, it will be awaited before sending. If the
- * session closes while awaiting, 0n is returned silently.
- * @param {ArrayBufferView|string|Promise} datagram The datagram payload
+ * @param {ArrayBufferView|string} datagram The datagram payload
* @param {string} [encoding] The encoding to use if datagram is a string
- * @returns {Promise<bigint>} The datagram ID
+ * @returns {bigint} The datagram ID
*/
- async sendDatagram(datagram, encoding = 'utf8') {
+ sendDatagram(datagram, encoding = 'utf8') {
assertIsQuicSession(this);
if (this.#isClosedOrClosing) {
throw new ERR_INVALID_STATE('Session is closed');
@@ -3350,13 +3347,6 @@ class QuicSession {
// either case, we do not send the datagram.
if (maxDatagramSize === 0) return kNilDatagramId;
- if (isPromise(datagram)) {
- datagram = await datagram;
- // Session may have closed while awaiting. Since datagrams are
- // inherently unreliable, silently return rather than throwing.
- if (this.#isClosedOrClosing) return kNilDatagramId;
- }
-
if (typeof datagram === 'string') {
datagram = new Uint8Array(Buffer.from(datagram, encoding));
} else if (!isArrayBufferView(datagram)) {
diff --git a/test/parallel/test-quic-callback-error-ondatagram-async.mjs b/test/parallel/test-quic-callback-error-ondatagram-async.mjs
index 23eade07161..1f253e8e19a 100644
--- a/test/parallel/test-quic-callback-error-ondatagram-async.mjs
+++ b/test/parallel/test-quic-callback-error-ondatagram-async.mjs
@@ -35,7 +35,7 @@ const clientSession = await connect(serverEndpoint.address, {
});
await clientSession.opened;
-await clientSession.sendDatagram(new Uint8Array([1, 2, 3]));
+clientSession.sendDatagram(new Uint8Array([1, 2, 3]));
await serverDone.promise;
await clientSession.closed;
diff --git a/test/parallel/test-quic-callback-error-ondatagram.mjs b/test/parallel/test-quic-callback-error-ondatagram.mjs
index c9700114dcb..21956ea7981 100644
--- a/test/parallel/test-quic-callback-error-ondatagram.mjs
+++ b/test/parallel/test-quic-callback-error-ondatagram.mjs
@@ -36,7 +36,7 @@ const clientSession = await connect(serverEndpoint.address, {
await clientSession.opened;
// Send a datagram to trigger the server's ondatagram callback.
-await clientSession.sendDatagram(new Uint8Array([1, 2, 3]));
+clientSession.sendDatagram(new Uint8Array([1, 2, 3]));
await serverDone.promise;
await clientSession.closed;
diff --git a/test/parallel/test-quic-callback-error-ondatagramstatus.mjs b/test/parallel/test-quic-callback-error-ondatagramstatus.mjs
index 7c4c102866f..bf2171b1542 100644
--- a/test/parallel/test-quic-callback-error-ondatagramstatus.mjs
+++ b/test/parallel/test-quic-callback-error-ondatagramstatus.mjs
@@ -32,7 +32,7 @@ const clientSession = await connect(serverEndpoint.address, {
await clientSession.opened;
// Send a datagram. The status callback fires when the peer ACKs it.
-await clientSession.sendDatagram(new Uint8Array([1, 2, 3]));
+clientSession.sendDatagram(new Uint8Array([1, 2, 3]));
// The session's closed should reject with the error from the throw.
await assert.rejects(clientSession.closed, testError);
diff --git a/test/parallel/test-quic-datagram-abandoned.mjs b/test/parallel/test-quic-datagram-abandoned.mjs
index 69032ca2144..e90a0972460 100644
--- a/test/parallel/test-quic-datagram-abandoned.mjs
+++ b/test/parallel/test-quic-datagram-abandoned.mjs
@@ -43,9 +43,9 @@ clientSession.maxPendingDatagrams = 2;
// Send 3 datagrams with a queue size of 2. The first datagram should
// be abandoned when the third is sent (drop-oldest policy is default).
-ids[0] = await clientSession.sendDatagram(new Uint8Array([1]));
-ids[1] = await clientSession.sendDatagram(new Uint8Array([2]));
-ids[2] = await clientSession.sendDatagram(new Uint8Array([3]));
+ids[0] = clientSession.sendDatagram(new Uint8Array([1]));
+ids[1] = clientSession.sendDatagram(new Uint8Array([2]));
+ids[2] = clientSession.sendDatagram(new Uint8Array([3]));
assert.notStrictEqual(ids[0], 0n);
assert.notStrictEqual(ids[1], 0n);
diff --git a/test/parallel/test-quic-datagram-drop-newest.mjs b/test/parallel/test-quic-datagram-drop-newest.mjs
index 285d96f01b5..e349013db35 100644
--- a/test/parallel/test-quic-datagram-drop-newest.mjs
+++ b/test/parallel/test-quic-datagram-drop-newest.mjs
@@ -67,7 +67,7 @@ clientSession.maxPendingDatagrams = 2;
// Send 5 datagrams. With drop-newest, the 3rd/4th/5th are rejected
// (the queue holds the 1st and 2nd).
for (let i = 0; i < 5; i++) {
- await clientSession.sendDatagram(new Uint8Array([i]));
+ clientSession.sendDatagram(new Uint8Array([i]));
}
await Promise.all([allReceived.promise, allStatusReceived.promise]);
diff --git a/test/parallel/test-quic-datagram-drop-oldest.mjs b/test/parallel/test-quic-datagram-drop-oldest.mjs
index 3c1b92be411..120c90423c1 100644
--- a/test/parallel/test-quic-datagram-drop-oldest.mjs
+++ b/test/parallel/test-quic-datagram-drop-oldest.mjs
@@ -68,7 +68,7 @@ clientSession.maxPendingDatagrams = 2;
// 1 queued, 2 queued, 3 arrives → 1 dropped, 4 arrives → 2 dropped,
// 5 arrives → 3 dropped. Queue ends with [4, 5].
for (let i = 0; i < 5; i++) {
- await clientSession.sendDatagram(new Uint8Array([i]));
+ clientSession.sendDatagram(new Uint8Array([i]));
}
await Promise.all([allReceived.promise, allStatusReceived.promise]);
diff --git a/test/parallel/test-quic-datagram-echo.mjs b/test/parallel/test-quic-datagram-echo.mjs
index 792d1c2d644..a8836f36f7c 100644
--- a/test/parallel/test-quic-datagram-echo.mjs
+++ b/test/parallel/test-quic-datagram-echo.mjs
@@ -61,7 +61,7 @@ const clientSession = await connect(serverEndpoint.address, {
await clientSession.opened;
// Client sends datagram to trigger the echo.
-await clientSession.sendDatagram(new Uint8Array([10, 20, 30]));
+clientSession.sendDatagram(new Uint8Array([10, 20, 30]));
await Promise.all([serverGot.promise, clientGot.promise, clientSession.closed]);
diff --git a/test/parallel/test-quic-datagram-edge-cases.mjs b/test/parallel/test-quic-datagram-edge-cases.mjs
index 589168dd20a..289a26421e2 100644
--- a/test/parallel/test-quic-datagram-edge-cases.mjs
+++ b/test/parallel/test-quic-datagram-edge-cases.mjs
@@ -29,11 +29,11 @@ const { listen, connect } = await import('../common/quic.mjs');
await clientSession.opened;
// Zero-length ArrayBufferView
- const zeroId = await clientSession.sendDatagram(new Uint8Array(0));
+ const zeroId = clientSession.sendDatagram(new Uint8Array(0));
assert.strictEqual(zeroId, 0n);
// Zero-length string
- const emptyStringId = await clientSession.sendDatagram('');
+ const emptyStringId = clientSession.sendDatagram('');
assert.strictEqual(emptyStringId, 0n);
await clientSession.close();
@@ -58,7 +58,7 @@ const { listen, connect } = await import('../common/quic.mjs');
assert.strictEqual(clientSession.maxDatagramSize, 0);
// Sending returns 0n immediately — datagram not sent.
- const id = await clientSession.sendDatagram(new Uint8Array([1, 2, 3]));
+ const id = clientSession.sendDatagram(new Uint8Array([1, 2, 3]));
assert.strictEqual(id, 0n);
await clientSession.close();
@@ -83,7 +83,7 @@ const { listen, connect } = await import('../common/quic.mjs');
await clientSession.opened;
// Send a datagram even though the server has no ondatagram handler.
- const id = await clientSession.sendDatagram(new Uint8Array([1, 2, 3]));
+ const id = clientSession.sendDatagram(new Uint8Array([1, 2, 3]));
assert.notStrictEqual(id, 0n);
await clientSession.closed;
diff --git a/test/parallel/test-quic-datagram-multiple.mjs b/test/parallel/test-quic-datagram-multiple.mjs
index cc45bf793a0..15ba4f35854 100644
--- a/test/parallel/test-quic-datagram-multiple.mjs
+++ b/test/parallel/test-quic-datagram-multiple.mjs
@@ -69,7 +69,7 @@ const stream = clientSession.createBidirectionalStream({
// Send multiple datagrams alongside the active stream.
for (let i = 0; i < numDatagrams; i++) {
- await clientSession.sendDatagram(new Uint8Array([i]));
+ clientSession.sendDatagram(new Uint8Array([i]));
}
// Complete the stream.
diff --git a/test/parallel/test-quic-datagram-no-detach.mjs b/test/parallel/test-quic-datagram-no-detach.mjs
index 83c42c0221d..e5b61f7809a 100644
--- a/test/parallel/test-quic-datagram-no-detach.mjs
+++ b/test/parallel/test-quic-datagram-no-detach.mjs
@@ -37,11 +37,11 @@ await clientSession.opened;
// multiple sendDatagram calls.
const source = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]);
-const firstId = await clientSession.sendDatagram(source);
+const firstId = clientSession.sendDatagram(source);
assert.notStrictEqual(firstId, 0n);
assert.strictEqual(source.buffer.detached, false); // source ArrayBuffer must not be detached after sendDatagram
-const secondId = await clientSession.sendDatagram(source);
+const secondId = clientSession.sendDatagram(source);
assert.notStrictEqual(secondId, 0n);
assert.strictEqual(source.buffer.detached, false); // source ArrayBuffer must remain live after second sendDatagram
@@ -49,7 +49,7 @@ assert.strictEqual(source.buffer.detached, false); // source ArrayBuffer must re
// not affect what the peer ultimately receives — the bytes have
// already been copied into the QUIC layer's internal buffer.
source[0] = 99;
-const thirdId = await clientSession.sendDatagram(source);
+const thirdId = clientSession.sendDatagram(source);
assert.notStrictEqual(thirdId, 0n);
await allReceived.promise;
diff --git a/test/parallel/test-quic-datagram-size-limits.mjs b/test/parallel/test-quic-datagram-size-limits.mjs
index 9b3cf5665d8..56f12349393 100644
--- a/test/parallel/test-quic-datagram-size-limits.mjs
+++ b/test/parallel/test-quic-datagram-size-limits.mjs
@@ -49,13 +49,13 @@ assert.ok(maxSize < 200);
// DGRAM-03 / DGIMP-10: Datagram too large — returns 0n.
const oversized = new Uint8Array(maxSize + 1);
-const tooLargeId = await clientSession.sendDatagram(oversized);
+const tooLargeId = clientSession.sendDatagram(oversized);
assert.strictEqual(tooLargeId, 0n);
// Datagram at exactly maxDatagramSize — accepted and delivered.
const exactMax = new Uint8Array(maxSize);
exactMax[0] = 42;
-const exactId = await clientSession.sendDatagram(exactMax);
+const exactId = clientSession.sendDatagram(exactMax);
assert.notStrictEqual(exactId, 0n);
await Promise.all([serverGot.promise, clientSession.closed]);
diff --git a/test/parallel/test-quic-datagram-sources.mjs b/test/parallel/test-quic-datagram-sources.mjs
index 03c067ec263..78d7862f5fd 100644
--- a/test/parallel/test-quic-datagram-sources.mjs
+++ b/test/parallel/test-quic-datagram-sources.mjs
@@ -39,11 +39,11 @@ const { listen, connect } = await import('../common/quic.mjs');
await clientSession.opened;
// Send hex-encoded string — '48656c6c6f' is 'Hello' in hex.
- const hexId = await clientSession.sendDatagram('48656c6c6f', 'hex');
+ const hexId = clientSession.sendDatagram('48656c6c6f', 'hex');
assert.notStrictEqual(hexId, 0n);
// Send base64-encoded string — 'V29ybGQ=' is 'World' in base64.
- const b64Id = await clientSession.sendDatagram('V29ybGQ=', 'base64');
+ const b64Id = clientSession.sendDatagram('V29ybGQ=', 'base64');
assert.notStrictEqual(b64Id, 0n);
await allReceived.promise;
@@ -55,68 +55,7 @@ const { listen, connect } = await import('../common/quic.mjs');
await serverEndpoint.close();
}
-// --- DGIMP-02: Promise input ---
-{
- const serverGot = Promise.withResolvers();
-
- const serverEndpoint = await listen(mustCall(async (serverSession) => {
- await serverGot.promise;
- await serverSession.close();
- }), {
- transportParams: { maxDatagramFrameSize: 1200 },
- ondatagram: mustCall((data) => {
- assert.deepStrictEqual(Buffer.from(data), Buffer.from([42]));
- serverGot.resolve();
- }),
- });
-
- const clientSession = await connect(serverEndpoint.address, {
- transportParams: { maxDatagramFrameSize: 1200 },
- });
- await clientSession.opened;
-
- // Send a Promise that resolves to a Uint8Array.
- const promiseId = await clientSession.sendDatagram(
- Promise.resolve(new Uint8Array([42])),
- );
- assert.notStrictEqual(promiseId, 0n);
-
- await Promise.all([serverGot.promise, clientSession.closed]);
- await serverEndpoint.close();
-}
-
-// --- DGIMP-03: Promise input, session closes during await ---
-{
- const serverEndpoint = await listen(mustCall(async (serverSession) => {
- await serverSession.closed;
- }), {
- transportParams: { maxIdleTimeout: 1, maxDatagramFrameSize: 1200 },
- onerror() {},
- });
-
- const clientSession = await connect(serverEndpoint.address, {
- transportParams: { maxIdleTimeout: 1, maxDatagramFrameSize: 1200 },
- });
- await clientSession.opened;
-
- // Create a promise that resolves after the session starts closing.
- // sendDatagram passes the initial checks, then awaits the promise.
- // While awaiting, the session closes. When the promise resolves,
- // sendDatagram finds the session closed and returns 0n.
- const slowPromise = new Promise((resolve) => {
- setImmediate(mustCall(async () => {
- await clientSession.close();
- resolve(new Uint8Array([1]));
- }));
- });
-
- const id = await clientSession.sendDatagram(slowPromise);
- assert.strictEqual(id, 0n);
-
- await serverEndpoint.close();
-}
-
-// --- DGIMP-04: SharedArrayBuffer ---
+// --- DGIMP-02: SharedArrayBuffer ---
{
const serverGot = Promise.withResolvers();
@@ -143,7 +82,7 @@ const { listen, connect } = await import('../common/quic.mjs');
view[1] = 20;
view[2] = 30;
- const id = await clientSession.sendDatagram(view);
+ const id = clientSession.sendDatagram(view);
assert.notStrictEqual(id, 0n);
// The SharedArrayBuffer should still be usable (copied, not transferred).
@@ -153,7 +92,7 @@ const { listen, connect } = await import('../common/quic.mjs');
await serverEndpoint.close();
}
-// --- DGIMP-05: Pooled Buffer (partial view) ---
+// --- DGIMP-03: Pooled Buffer (partial view) ---
{
const serverGot = Promise.withResolvers();
@@ -177,14 +116,14 @@ const { listen, connect } = await import('../common/quic.mjs');
// Buffer.from('hello') creates a pooled buffer — its backing
// ArrayBuffer is larger and the view has a non-zero offset.
const pooledBuf = Buffer.from('hello');
- const id = await clientSession.sendDatagram(pooledBuf);
+ const id = clientSession.sendDatagram(pooledBuf);
assert.notStrictEqual(id, 0n);
await Promise.all([serverGot.promise, clientSession.closed]);
await serverEndpoint.close();
}
-// --- DGIMP-06: DataView ---
+// --- DGIMP-04: DataView ---
{
const serverGot = Promise.withResolvers();
@@ -210,7 +149,7 @@ const { listen, connect } = await import('../common/quic.mjs');
// DataView over bytes [2, 3] of the buffer.
const dv = new DataView(ab, 2, 2);
- const id = await clientSession.sendDatagram(dv);
+ const id = clientSession.sendDatagram(dv);
assert.notStrictEqual(id, 0n);
await Promise.all([serverGot.promise, clientSession.closed]);
diff --git a/test/parallel/test-quic-datagram-status.mjs b/test/parallel/test-quic-datagram-status.mjs
index 264f905650b..fb61cfa52a5 100644
--- a/test/parallel/test-quic-datagram-status.mjs
+++ b/test/parallel/test-quic-datagram-status.mjs
@@ -59,7 +59,7 @@ const clientSession = await connect(serverEndpoint.address, {
});
await clientSession.opened;
-const id = await clientSession.sendDatagram(new Uint8Array([1, 2, 3]));
+const id = clientSession.sendDatagram(new Uint8Array([1, 2, 3]));
// Wait for the server to receive and the status callback to fire.
await Promise.all([serverGot.promise, statusReceived.promise]);
diff --git a/test/parallel/test-quic-datagram-utf8.mjs b/test/parallel/test-quic-datagram-utf8.mjs
index e6f24286c9b..1565ca1c1d1 100644
--- a/test/parallel/test-quic-datagram-utf8.mjs
+++ b/test/parallel/test-quic-datagram-utf8.mjs
@@ -37,7 +37,7 @@ const clientSession = await connect(serverEndpoint.address, {
});
await clientSession.opened;
-const id = await clientSession.sendDatagram(message);
+const id = clientSession.sendDatagram(message);
assert.strictEqual(id, 1n);
await Promise.all([serverGot.promise, clientSession.closed]);
diff --git a/test/parallel/test-quic-datagram.mjs b/test/parallel/test-quic-datagram.mjs
index 2de13bc772e..5d189d791b2 100644
--- a/test/parallel/test-quic-datagram.mjs
+++ b/test/parallel/test-quic-datagram.mjs
@@ -53,7 +53,7 @@ assert.ok(clientSession.maxDatagramSize > 0);
assert.ok(clientSession.maxDatagramSize < 1200);
// Client sends datagram.
-const id = await clientSession.sendDatagram(new Uint8Array([1, 2, 3]));
+const id = clientSession.sendDatagram(new Uint8Array([1, 2, 3]));
assert.strictEqual(id, 1n);
await Promise.all([serverGot.promise, clientSession.closed]);
diff --git a/test/parallel/test-quic-diagnostics-channel-datagram-status.mjs b/test/parallel/test-quic-diagnostics-channel-datagram-status.mjs
index 17a3bfefd48..0c57b50b311 100644
--- a/test/parallel/test-quic-diagnostics-channel-datagram-status.mjs
+++ b/test/parallel/test-quic-diagnostics-channel-datagram-status.mjs
@@ -38,7 +38,7 @@ const clientSession = await connect(serverEndpoint.address, {
});
await clientSession.opened;
-await clientSession.sendDatagram(new Uint8Array([1, 2, 3]));
+clientSession.sendDatagram(new Uint8Array([1, 2, 3]));
// Wait for the status event before closing.
await statusDone.promise;
diff --git a/test/parallel/test-quic-diagnostics-channel-datagram.mjs b/test/parallel/test-quic-diagnostics-channel-datagram.mjs
index 578c338fc7f..2c6404b2dfa 100644
--- a/test/parallel/test-quic-diagnostics-channel-datagram.mjs
+++ b/test/parallel/test-quic-diagnostics-channel-datagram.mjs
@@ -43,7 +43,7 @@ const clientSession = await connect(serverEndpoint.address, {
});
await clientSession.opened;
-await clientSession.sendDatagram(new Uint8Array([1, 2, 3]));
+clientSession.sendDatagram(new Uint8Array([1, 2, 3]));
await serverGot.promise;
await clientSession.close();
diff --git a/test/parallel/test-quic-edge-closing-ops.mjs b/test/parallel/test-quic-edge-closing-ops.mjs
index 96115555396..79d73b7a44a 100644
--- a/test/parallel/test-quic-edge-closing-ops.mjs
+++ b/test/parallel/test-quic-edge-closing-ops.mjs
@@ -39,8 +39,8 @@ assert.throws(
);
// sendDatagram on a closing session throws.
-await assert.rejects(
- clientSession.sendDatagram(new Uint8Array([1, 2, 3])),
+assert.throws(
+ () => clientSession.sendDatagram(new Uint8Array([1, 2, 3])),
{ code: 'ERR_INVALID_STATE' },
);
diff --git a/test/parallel/test-quic-edge-destroyed-ops.mjs b/test/parallel/test-quic-edge-destroyed-ops.mjs
index b6614f00c59..636c4d26b02 100644
--- a/test/parallel/test-quic-edge-destroyed-ops.mjs
+++ b/test/parallel/test-quic-edge-destroyed-ops.mjs
@@ -45,8 +45,8 @@ assert.strictEqual(clientSession.ephemeralKeyInfo, undefined);
clientSession.destroy();
// sendDatagram on destroyed session throws ERR_INVALID_STATE.
-await assert.rejects(
- clientSession.sendDatagram(new Uint8Array([1])),
+assert.throws(
+ () => clientSession.sendDatagram(new Uint8Array([1])),
{ code: 'ERR_INVALID_STATE' },
);
diff --git a/test/parallel/test-quic-h3-datagram.mjs b/test/parallel/test-quic-h3-datagram.mjs
index d2e7f8fbbdf..83159eebcb3 100644
--- a/test/parallel/test-quic-h3-datagram.mjs
+++ b/test/parallel/test-quic-h3-datagram.mjs
@@ -92,7 +92,7 @@ const decoder = new TextDecoder();
});
// Send datagram from client.
- await clientSession.sendDatagram(new Uint8Array([10, 20, 30]));
+ clientSession.sendDatagram(new Uint8Array([10, 20, 30]));
// H3 response body is received.
const body = await bytes(stream);
diff --git a/test/parallel/test-quic-preferred-address-ignore.mjs b/test/parallel/test-quic-preferred-address-ignore.mjs
index 41c132cbcfa..f0c98280d1a 100644
--- a/test/parallel/test-quic-preferred-address-ignore.mjs
+++ b/test/parallel/test-quic-preferred-address-ignore.mjs
@@ -45,8 +45,8 @@ const clientSession = await connect(serverEndpoint.address, {
});
await clientSession.opened;
-await clientSession.sendDatagram(new Uint8Array([1]));
-await clientSession.sendDatagram(new Uint8Array([2]));
+clientSession.sendDatagram(new Uint8Array([1]));
+clientSession.sendDatagram(new Uint8Array([2]));
await Promise.all([serverGot.promise, allStatusDone.promise]);
diff --git a/test/parallel/test-quic-session-preferred-address-ignore.mjs b/test/parallel/test-quic-session-preferred-address-ignore.mjs
index b4694963065..d4212eb5f86 100644
--- a/test/parallel/test-quic-session-preferred-address-ignore.mjs
+++ b/test/parallel/test-quic-session-preferred-address-ignore.mjs
@@ -52,10 +52,10 @@ const clientSession = await connect(serverEndpoint.address, {
await clientSession.opened;
// Send datagrams.
-await clientSession.sendDatagram(new Uint8Array([1]));
-await clientSession.sendDatagram(new Uint8Array([2]));
-await clientSession.sendDatagram(new Uint8Array([3]));
-await clientSession.sendDatagram(new Uint8Array([4]));
+clientSession.sendDatagram(new Uint8Array([1]));
+clientSession.sendDatagram(new Uint8Array([2]));
+clientSession.sendDatagram(new Uint8Array([3]));
+clientSession.sendDatagram(new Uint8Array([4]));
await Promise.all([serverGot.promise, allStatusDone.promise]);
diff --git a/test/parallel/test-quic-session-preferred-address-ipv6.mjs b/test/parallel/test-quic-session-preferred-address-ipv6.mjs
index 8c1d9c474cc..3dfe2d51547 100644
--- a/test/parallel/test-quic-session-preferred-address-ipv6.mjs
+++ b/test/parallel/test-quic-session-preferred-address-ipv6.mjs
@@ -104,16 +104,16 @@ const clientSession = await connect(serverEndpoint.address, {
await clientSession.opened;
// Send two datagrams.
-await clientSession.sendDatagram(new Uint8Array([1]));
-await clientSession.sendDatagram(new Uint8Array([2]));
+clientSession.sendDatagram(new Uint8Array([1]));
+clientSession.sendDatagram(new Uint8Array([2]));
await serverPathValidated.promise;
// Send more datagrams after the preferred address migration completes
// To show that data is still flowing after we close the original
// endpoint.
-await clientSession.sendDatagram(new Uint8Array([3]));
-await clientSession.sendDatagram(new Uint8Array([4]));
+clientSession.sendDatagram(new Uint8Array([3]));
+clientSession.sendDatagram(new Uint8Array([4]));
await Promise.all([serverGot.promise, allStatusDone.promise]);
diff --git a/test/parallel/test-quic-session-preferred-address.mjs b/test/parallel/test-quic-session-preferred-address.mjs
index 92194cf42a8..27a2d6ee771 100644
--- a/test/parallel/test-quic-session-preferred-address.mjs
+++ b/test/parallel/test-quic-session-preferred-address.mjs
@@ -83,16 +83,16 @@ const clientSession = await connect(serverEndpoint.address, {
await clientSession.opened;
// Send two datagrams.
-await clientSession.sendDatagram(new Uint8Array([1]));
-await clientSession.sendDatagram(new Uint8Array([2]));
+clientSession.sendDatagram(new Uint8Array([1]));
+clientSession.sendDatagram(new Uint8Array([2]));
await serverPathValidated.promise;
// Send more datagrams after the preferred address migration completes
// To show that data is still flowing after we close the original
// endpoint.
-await clientSession.sendDatagram(new Uint8Array([3]));
-await clientSession.sendDatagram(new Uint8Array([4]));
+clientSession.sendDatagram(new Uint8Array([3]));
+clientSession.sendDatagram(new Uint8Array([4]));
await Promise.all([serverGot.promise, allStatusDone.promise]);
diff --git a/test/parallel/test-quic-session-stats-datagram.mjs b/test/parallel/test-quic-session-stats-datagram.mjs
index 621fb37bd02..45db535a2ad 100644
--- a/test/parallel/test-quic-session-stats-datagram.mjs
+++ b/test/parallel/test-quic-session-stats-datagram.mjs
@@ -43,8 +43,8 @@ const clientSession = await connect(serverEndpoint.address, {
await clientSession.opened;
// Send two datagrams.
-await clientSession.sendDatagram(new Uint8Array([1]));
-await clientSession.sendDatagram(new Uint8Array([2]));
+clientSession.sendDatagram(new Uint8Array([1]));
+clientSession.sendDatagram(new Uint8Array([2]));
await Promise.all([serverGot.promise, allStatusDone.promise]);
diff --git a/test/parallel/test-quic-zero-rtt-datagram.mjs b/test/parallel/test-quic-zero-rtt-datagram.mjs
index 02a44a3e6b3..57d85e142b2 100644
--- a/test/parallel/test-quic-zero-rtt-datagram.mjs
+++ b/test/parallel/test-quic-zero-rtt-datagram.mjs
@@ -64,7 +64,7 @@ const cs2 = await connect(serverEndpoint.address, {
});
// Send datagram BEFORE the handshake completes — true 0-RTT.
-await cs2.sendDatagram(new Uint8Array([0xCA, 0xFE]));
+cs2.sendDatagram(new Uint8Array([0xCA, 0xFE]));
const info2 = await cs2.opened;
assert.strictEqual(info2.earlyDataAttempted, true);
diff --git a/test/parallel/test-quic-zero-rtt-disabled-server.mjs b/test/parallel/test-quic-zero-rtt-disabled-server.mjs
index ee23e8de2cb..9ba2e0cae83 100644
--- a/test/parallel/test-quic-zero-rtt-disabled-server.mjs
+++ b/test/parallel/test-quic-zero-rtt-disabled-server.mjs
@@ -83,7 +83,7 @@ const alpn = ['quic-test'];
// The deferred handshake needs a send to trigger. Use sendDatagram
// since it's simpler than a stream for this test.
- await cs2.sendDatagram(new Uint8Array([1]));
+ cs2.sendDatagram(new Uint8Array([1]));
const info2 = await cs2.opened;
assert.strictEqual(info2.earlyDataAttempted, true);