Skip to content

Commit 7f0aad1

Browse files
mxindenmoz-wptsync-bot
authored andcommitted
enable QUIC PMTUD
Differential Revision: https://phabricator.services.mozilla.com/D223575 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1909910 gecko-commit: 0da897321dc6c369fe095040ca5b2fef50e7ce3d gecko-reviewers: necko-reviewers, kershaw
1 parent 2ebbe32 commit 7f0aad1

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

webtransport/datagrams.https.any.js

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,25 @@ promise_test(async t => {
199199
const writer = wt.datagrams.writable.getWriter();
200200
const reader = wt.datagrams.readable.getReader();
201201

202-
// Write and read max-size datagram.
203-
await writer.write(new Uint8Array(wt.datagrams.maxDatagramSize+1));
204-
// This should resolve with no datagram sent, which is hard to test for.
205-
// Wait for incoming datagrams to arrive, and if they do, fail.
206-
const result = await Promise.race([reader.read(), wait(500)]);
207-
assert_equals(result, undefined);
208-
}, 'Fail to transfer max-size+1 datagram');
202+
let maxDatagramSize = wt.datagrams.maxDatagramSize;
203+
204+
while (true) {
205+
// Write and read max-size datagram.
206+
await writer.write(new Uint8Array(maxDatagramSize + 1));
207+
// This should resolve with no datagram sent, which is hard to test for.
208+
// Wait for incoming datagrams to arrive, and if they do, fail.
209+
const result = await Promise.race([reader.read(), wait(500)]);
210+
if (result === undefined) {
211+
return; // Success, no datagram received, exit the test early.
212+
}
213+
214+
// Maybe QUIC's PMTUD increased the max-size datagram in the meantime. If
215+
// so, try again.
216+
const currentMaxDatagramSize = wt.datagrams.maxDatagramSize;
217+
assert_greater_than(currentMaxDatagramSize, maxDatagramSize);
218+
maxDatagramSize = currentMaxDatagramSize;
219+
}
220+
}, 'Fail to transfer max-size+1 datagram, handle PMTUD increases');
209221

210222
promise_test(async t => {
211223
// Make a WebTransport connection, but session is not necessarily established.

0 commit comments

Comments
 (0)