Something went wrong. Try again.
QUIC for Zig 0.17: RFC 9000-9002 with TLS 1.3, as a sans-I/O core plus a socket layer, with datagrams, multipath and raw public keys.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610// SPDX-FileCopyrightText: © 2026 Jeffrey C. Ollie <jeff@ocjtech.us>// SPDX-License-Identifier: MIT
//! What a receiver remembers about the packets it has received, and the ACK//! frames it builds from that.//!//! One of these per packet number space (§12.3), because the three spaces are//! separate in every way that matters: each numbers its packets from zero,//! and a packet in one can only be acknowledged in a packet of the same kind.//! Acknowledging an Initial packet in a Handshake packet is not merely wrong,//! it is a statement about a packet number that means something else.//!//! ## The shape of the data, and why it is bounded//!//! Received packet numbers are kept as a list of inclusive ranges, newest//! first, which is also the shape an ACK frame wants — §19.3 is a largest//! acknowledged and then a walk downwards. Ordinary traffic keeps this at one//! range: packets arrive in order, and each one extends the newest range by//! one.//!//! What makes it grow is gaps, and a peer can manufacture those. Sending//! every other packet number, or dropping one in ten, produces a range per//! gap — so an endpoint that kept all of them would have its memory decided//! by whoever is talking to it. The list is therefore fixed and the oldest//! range is dropped when it is full, which is what every implementation does//! and what §13.2.3 anticipates when it says an endpoint "is not obligated to//! acknowledge" what it can no longer describe.//!//! The cost of dropping is bounded and dull: a peer that is not told its//! packet arrived eventually retransmits it. The cost of not dropping is that//! a connection's memory is an attacker's parameter.
const std = @import("std");const ecn = @import("ecn.zig");const assert = std.debug.assert;
const frame = @import("frame.zig");const varint = @import("varint.zig");
/// How many disjoint ranges of received packet numbers to remember.////// Thirty-two is the conventional number and is generous: reaching it needs/// thirty-two separate gaps in flight at once, which ordinary loss does not/// produce and which a peer gains nothing by manufacturing.pub const max_ranges = 32;
pub const Range = struct { smallest: u64, largest: u64,
pub fn contains(r: Range, n: u64) bool { return n >= r.smallest and n <= r.largest; }};
pub const Error = error{ /// The ACK would not fit in the buffer offered for it. NoSpace,};
/// The two-bit ECN field of an IP header, re-exported so that a caller/// handing one to `record` need not know where it is defined.////// It arrives with a datagram rather than inside it -- a QUIC packet has no/// room for its own copy -- so a caller that cannot read its platform's IP/// header has nothing to pass and says `not_ect`. §13.4.1 of RFC 9000 allows/// exactly that: "The use of ECN requires the receiving endpoint to read the/// ECN field from an IP packet, which is not possible on all platforms. If an/// endpoint does not implement ECN support or does not have access to/// received ECN fields, it does not report ECN counts for packets it/// receives."pub const Codepoint = ecn.Codepoint;
/// draft-ietf-quic-ack-frequency-14 §4: what the peer has asked of this/// end's acknowledgements, from the newest ACK_FREQUENCY frame it sent.pub const Frequency = struct { /// Acknowledge once more than this many ack-eliciting packets have /// arrived since the last ACK. threshold: u64 = 1, /// ...or once this long has passed since the first of them, in /// nanoseconds. max_delay: u64, /// The reordering that has an ACK sent at once; 0 for none, 1 for any. reordering: u64 = 1,};
pub const Tracker = struct { /// Newest first, disjoint, and never adjacent — two ranges that touch are /// merged, or the same set of packets would have two spellings and the /// ACK frames built from it would differ for no reason. ranges: [max_ranges]Range = undefined, len: usize = 0, /// Whether anything has arrived since the last ACK that obliges one. /// /// §13.2.1: only an ack-eliciting packet does. A packet carrying nothing /// but ACKs and PADDING is not acknowledged, because the acknowledgement /// would itself be a packet needing one. ack_eliciting_pending: bool = false, /// §13.4.1: "On receiving an IP packet with an ECT(0), ECT(1), or ECN-CE /// codepoint, an ECN-enabled endpoint accesses the ECN field and /// increases the corresponding ECT(0), ECT(1), or ECN-CE count." /// /// Per packet number space, because "each packet number space maintains /// separate acknowledgment state and separate ECN counts", and counted /// once per QUIC packet rather than once per datagram: coalesced packets /// "share the same IP header so the ECN counts are incremented once for /// each coalesced QUIC packet". ect0: u64 = 0, ect1: u64 = 0, ce: u64 = 0, /// Whether any marked packet has been seen in this space. /// /// What decides whether an ACK frame carries counts at all. Reporting /// zeros would be a claim -- §13.4.2.1 has a sender fail validation when /// "the corresponding ECN counts are not present", so counts that are /// present and zero say the path stripped the marking, which is a /// different statement from having nothing to report. marked: bool = false,
// -- when to acknowledge, draft-ietf-quic-ack-frequency-14 §6 ------------- // // None of this changes anything until the peer sends an ACK_FREQUENCY // frame: without one, `due` says an ACK is owed the moment anything // ack-eliciting is, which is what this library has always done and is // RFC 9000 §13.2.1 at its most eager.
/// Ack-eliciting packets since the last ACK went out, and when the first /// of them arrived. eliciting_since: u64 = 0, first_eliciting_at: ?u64 = null, /// When the largest packet number so far arrived, which an ACK's delay /// is measured from. largest_at: u64 = 0, /// The Largest Acknowledged of the last ACK sent, §6.2's Largest Acked. largest_acked_sent: ?u64 = null, /// Something has asked for an ACK now: reordering past the peer's /// threshold, a first CE mark, or an IMMEDIATE_ACK frame. immediate: bool = false, /// Whether the last packet was CE-marked, for §6.3's transition. last_ce: bool = false,
/// Records a packet and decides whether it calls for an ACK sooner than /// the peer's ACK_FREQUENCY would otherwise allow. `frequency` is null /// until the peer has sent one. pub fn arrived(t: *Tracker, number: u64, ack_eliciting: bool, ce: bool, now: u64, frequency: ?Frequency) void { const was_largest = t.largest(); const duplicate = t.contains(number); t.record(number, ack_eliciting); if (was_largest == null or number > was_largest.?) t.largest_at = now; const previous_ce = t.last_ce; t.last_ce = ce; if (!ack_eliciting or duplicate) return; t.eliciting_since += 1; if (t.first_eliciting_at == null) t.first_eliciting_at = now;
const f = frequency orelse return; // §6.3: "If the Ack-Eliciting Threshold is larger than 1, an endpoint // SHOULD send an immediate acknowledgement when a packet marked with // the ECN Congestion Experienced (CE) codepoint in the IP header is // received and the previously received packet was not marked CE." // At 1 RFC 9000's rule applies, which is every CE mark; at 0 every // packet is acknowledged anyway. if (ce and (f.threshold == 1 or (f.threshold > 1 and !previous_ce))) t.immediate = true; if (t.outOfOrderDue(number, was_largest, f.reordering)) t.immediate = true; }
/// §6.2: whether packet `number`, just recorded, is reordering enough to /// be acknowledged at once. fn outOfOrderDue(t: *const Tracker, number: u64, was_largest: ?u64, reordering: u64) bool { // "A value of 0 indicates out-of-order packets do not elicit an // immediate ACK." if (reordering == 0) return false; const previous = was_largest orelse return false; // At 1, RFC 9000 §13.2.1: any packet that arrives below one already // seen, or leaves a gap below itself. if (reordering == 1) return number < previous or number > previous + 1;
const largest_unacked = t.largest() orelse return false; // "The received packet number is less than or equal to Largest Acked // - Reordering Threshold": a packet the sender has probably already // declared lost, which it wants to hear about to undo that. if (t.largest_acked_sent) |acked| { if (acked >= reordering and number <= acked - reordering) return true; } // "The difference between the smallest Unreported Missing packet and // the Largest Unacked packet is greater than or equal to the // Reordering Threshold value." Unreported Missing are the gaps above // Largest Reported Missing, Largest Acked - Reordering Threshold; with // no ACK sent yet, every gap is unreported. var lo: u64 = if (t.largest_acked_sent) |acked| (if (acked >= reordering) acked - reordering + 1 else 0) else 0; if (t.len > 0) lo = @max(lo, t.ranges[t.len - 1].smallest); const missing = t.smallestMissingFrom(lo) orelse return false; if (missing >= largest_unacked) return false; return largest_unacked - missing >= reordering; }
/// The smallest packet number at or above `from` that has not arrived. fn smallestMissingFrom(t: *const Tracker, from: u64) ?u64 { var candidate = from; var i = t.len; while (i > 0) { i -= 1; const r = t.ranges[i]; if (candidate < r.smallest) return candidate; if (candidate <= r.largest) candidate = r.largest + 1; } return candidate; }
/// Whether an ACK is owed now. Without an ACK_FREQUENCY from the peer, /// whenever anything ack-eliciting is waiting; with one, once more than /// its threshold is, or its delay has run out, or something above has /// asked for one at once. pub fn due(t: *const Tracker, now: u64, frequency: ?Frequency) bool { if (!t.ack_eliciting_pending or t.len == 0) return false; const f = frequency orelse return true; if (t.immediate) return true; if (t.eliciting_since > f.threshold) return true; const first = t.first_eliciting_at orelse return true; return now >= first +| f.max_delay; }
/// When an ACK being held back falls due, or null if none is. pub fn deadline(t: *const Tracker, frequency: ?Frequency) ?u64 { if (!t.ack_eliciting_pending) return null; const f = frequency orelse return null; const first = t.first_eliciting_at orelse return null; return first +| f.max_delay; }
/// §19.3's ACK Delay before scaling: how long the largest packet has /// waited to be acknowledged, in nanoseconds. pub fn delaySince(t: *const Tracker, now: u64) u64 { return now -| t.largest_at; }
/// §13.4.1: counts a processed packet against the codepoint its datagram /// carried. "ECN counts are only incremented when QUIC packets from the /// received IP packet are processed. As such, duplicate QUIC packets are /// not processed and do not increase ECN counts." pub fn countEcn(t: *Tracker, codepoint: Codepoint) void { switch (codepoint) { .not_ect => return, .ect0 => t.ect0 += 1, .ect1 => t.ect1 += 1, .ce => t.ce += 1, } t.marked = true; }
pub fn largest(t: *const Tracker) ?u64 { return if (t.len == 0) null else t.ranges[0].largest; }
pub fn isEmpty(t: *const Tracker) bool { return t.len == 0; }
/// Whether this packet number has already been received. /// /// §12.3 forbids a peer reusing a packet number, so a repeat is either a /// duplicate the network produced or a replay somebody produced. Either /// way §13.2 says not to process it twice, and this is the question that /// decides. pub fn contains(t: *const Tracker, number: u64) bool { for (t.ranges[0..t.len]) |r| { if (r.contains(number)) return true; // Sorted newest first, so once the ranges are below the number // there is nothing left to find. if (r.largest < number) return false; } return false; }
/// Notes that a packet arrived. pub fn record(t: *Tracker, number: u64, ack_eliciting: bool) void { if (ack_eliciting) t.ack_eliciting_pending = true; if (t.contains(number)) return;
// Find where it belongs: the ranges are descending, so this is the // first one whose largest is below the new number. var i: usize = 0; while (i < t.len and t.ranges[i].smallest > number + 1) : (i += 1) {}
// Extend downwards, upwards, or both -- and when it joins two ranges // that were only separated by it, merge them. if (i < t.len and t.ranges[i].smallest == number + 1) { t.ranges[i].smallest = number; t.mergeAt(i); return; } if (i < t.len and t.ranges[i].largest + 1 == number) { t.ranges[i].largest = number; if (i > 0) t.mergeAt(i - 1); return; }
t.insertAt(i, .{ .smallest = number, .largest = number }); }
/// Joins range `i` with `i + 1` if they have become adjacent. fn mergeAt(t: *Tracker, i: usize) void { if (i + 1 >= t.len) return; if (t.ranges[i].smallest != t.ranges[i + 1].largest + 1) return; t.ranges[i].smallest = t.ranges[i + 1].smallest; for (i + 1..t.len - 1) |j| t.ranges[j] = t.ranges[j + 1]; t.len -= 1; }
fn insertAt(t: *Tracker, i: usize, r: Range) void { if (t.len < max_ranges) { var j = t.len; while (j > i) : (j -= 1) t.ranges[j] = t.ranges[j - 1]; t.ranges[i] = r; t.len += 1; return; } // Full. The oldest range is the one to lose: it describes the packets // the peer is least likely to still be waiting to hear about, and a // range that is never acknowledged costs one retransmission. if (i >= max_ranges) return; var j: usize = max_ranges - 1; while (j > i) : (j -= 1) t.ranges[j] = t.ranges[j - 1]; t.ranges[i] = r; }
/// Writes an ACK frame describing everything received, and returns how /// many octets it took. /// /// `delay` is the encoded ACK Delay — §19.3 scales it by the /// `ack_delay_exponent` transport parameter, which this layer does not /// know, so the caller has already done that division. /// /// Does not clear `ack_eliciting_pending`: whether an ACK has actually /// been *sent* is something only the thing putting packets on the wire /// knows, and a frame written into a packet that is then abandoned has /// not been sent. `sent` is how that is said. pub fn writeAck(t: *const Tracker, out: []u8, delay: u64) Error!usize { assert(t.len > 0);
// The ranges beyond the first, encoded as §19.3.1's Gap and ACK Range // Length pairs. They have to be written before the frame header can // be, because the header carries the count. var ranges_buf: [max_ranges * 2 * 8]u8 = undefined; var ranges_at: usize = 0; var previous_smallest = t.ranges[0].smallest; for (t.ranges[1..t.len]) |r| { // §19.3.1: "largest = previous_smallest - gap - 2", so the gap is // two less than the distance between them. The ranges are // disjoint and never adjacent, so this cannot go negative. assert(previous_smallest > r.largest + 1); const gap = previous_smallest - r.largest - 2; ranges_at += varint.write(ranges_buf[ranges_at..], gap).len; ranges_at += varint.write(ranges_buf[ranges_at..], r.largest - r.smallest).len; previous_smallest = r.smallest; }
const f: frame.Frame = .{ .ack = .{ .largest = t.ranges[0].largest, .delay = delay, .range_count = t.len - 1, .first_range = t.ranges[0].largest - t.ranges[0].smallest, .encoded_ranges = ranges_buf[0..ranges_at], // §13.4.1: "Even if an endpoint does not set an ECT field in // packets it sends, the endpoint MUST provide feedback about ECN // markings it receives, if these are accessible. Failing to // report the ECN counts will cause the sender to disable the use // of ECN for this connection." .ecn = if (t.marked) .{ .ect0 = t.ect0, .ect1 = t.ect1, .ce = t.ce } else null, }, }; return frame.write(out, f) catch error.NoSpace; }
/// Notes that an ACK covering everything currently known has gone out. pub fn sent(t: *Tracker) void { t.ack_eliciting_pending = false; t.eliciting_since = 0; t.first_eliciting_at = null; t.immediate = false; t.largest_acked_sent = t.largest(); }};
const testing = std.testing;
test "packets arriving in order stay one range" { var t: Tracker = .{}; for (0..100) |n| t.record(n, true); try testing.expectEqual(@as(usize, 1), t.len); try testing.expectEqual(Range{ .smallest = 0, .largest = 99 }, t.ranges[0]); try testing.expectEqual(@as(?u64, 99), t.largest());}
test "a gap makes a second range, and filling it merges them back" { var t: Tracker = .{}; t.record(0, true); t.record(1, true); // 2 is missing. t.record(3, true); t.record(4, true); try testing.expectEqual(@as(usize, 2), t.len); try testing.expectEqual(Range{ .smallest = 3, .largest = 4 }, t.ranges[0]); try testing.expectEqual(Range{ .smallest = 0, .largest = 1 }, t.ranges[1]);
// The retransmission arrives and the two become one, because a set of // packet numbers must have exactly one representation here. t.record(2, true); try testing.expectEqual(@as(usize, 1), t.len); try testing.expectEqual(Range{ .smallest = 0, .largest = 4 }, t.ranges[0]);}
test "packets arriving backwards are still one range" { var t: Tracker = .{}; var n: u64 = 20; while (true) : (n -= 1) { t.record(n, true); if (n == 0) break; } try testing.expectEqual(@as(usize, 1), t.len); try testing.expectEqual(Range{ .smallest = 0, .largest = 20 }, t.ranges[0]);}
test "a duplicate is recognised and changes nothing" { var t: Tracker = .{}; t.record(5, true); t.record(5, true); t.record(5, true); try testing.expectEqual(@as(usize, 1), t.len); try testing.expectEqual(Range{ .smallest = 5, .largest = 5 }, t.ranges[0]);
try testing.expect(t.contains(5)); try testing.expect(!t.contains(4)); try testing.expect(!t.contains(6));}
test "the range list is bounded however many gaps a peer manufactures" { // Every other packet number, which is the cheapest way to make a range // per packet. Without a bound this is a peer choosing how much memory a // connection costs. var t: Tracker = .{}; var n: u64 = 0; while (n < 1000) : (n += 2) t.record(n, true); try testing.expectEqual(@as(usize, max_ranges), t.len);
// What survives is the newest, which is what the peer is most likely to // still be waiting to hear about. try testing.expectEqual(@as(?u64, 998), t.largest()); try testing.expect(t.contains(998)); try testing.expect(!t.contains(0));}
test "only an ack-eliciting packet obliges an acknowledgement" { // §13.2.1. A packet of nothing but ACKs does not need one, because the // acknowledgement would be a packet needing one in its turn. var t: Tracker = .{}; t.record(0, false); try testing.expect(!t.ack_eliciting_pending); t.record(1, true); try testing.expect(t.ack_eliciting_pending); t.sent(); try testing.expect(!t.ack_eliciting_pending);}
/// Reads an ACK frame back into the set of packet numbers it acknowledges.fn acknowledged(bytes: []const u8, out: *std.ArrayList(u64), gpa: std.mem.Allocator) !void { const got = try frame.parse(bytes); const a = got.frame.ack; const first = try a.firstRange(); var n = first.smallest; while (n <= first.largest) : (n += 1) try out.append(gpa, n);
var it = a.ranges(); while (try it.next()) |r| { var m = r.smallest; while (m <= r.largest) : (m += 1) try out.append(gpa, m); }}
test "an ACK frame describes exactly the packets that were received" { // The round trip that matters: what goes into the tracker comes out of // the frame, through an encoder and a decoder that share no code. const gpa = testing.allocator; const received = [_]u64{ 0, 1, 2, 5, 6, 9, 20, 21, 22, 100 };
var t: Tracker = .{}; for (received) |n| t.record(n, true);
var buf: [256]u8 = undefined; const len = try t.writeAck(&buf, 0);
var got: std.ArrayList(u64) = .empty; defer got.deinit(gpa); try acknowledged(buf[0..len], &got, gpa);
std.mem.sort(u64, got.items, {}, std.sort.asc(u64)); try testing.expectEqualSlices(u64, &received, got.items);}
test "an ACK of a single packet is the smallest frame there is" { var t: Tracker = .{}; t.record(0, true); var buf: [64]u8 = undefined; const len = try t.writeAck(&buf, 0);
// Type, largest, delay, count, first range -- five octets and no ranges. try testing.expectEqualSlices(u8, &.{ 0x02, 0x00, 0x00, 0x00, 0x00 }, buf[0..len]);
const got = try frame.parse(buf[0..len]); try testing.expectEqual(@as(u64, 0), got.frame.ack.largest); try testing.expectEqual(@as(u64, 0), got.frame.ack.range_count);}
test "an ACK that will not fit says so rather than writing a short one" { var t: Tracker = .{}; var n: u64 = 0; while (n < 60) : (n += 2) t.record(n, true); var tiny: [8]u8 = undefined; try testing.expectError(error.NoSpace, t.writeAck(&tiny, 0));}
test "the ACK delay is carried through untouched" { // §19.3 scales it by a transport parameter this layer does not know, so // it is the caller's number and passes through unexamined. var t: Tracker = .{}; t.record(7, true); var buf: [64]u8 = undefined; const len = try t.writeAck(&buf, 12345); const got = try frame.parse(buf[0..len]); try testing.expectEqual(@as(u64, 12345), got.frame.ack.delay);}
/// Feeds `numbers` through a tracker with only §6.2's reordering rule able to/// call for an ACK -- threshold and delay out of reach, as the draft's tables/// assume -- and says after which of them an ACK went out.fn reorderingAcks(reordering: u64, numbers: []const u64, out: []bool) void { var t: Tracker = .{}; const f: Frequency = .{ .threshold = 1000, .max_delay = std.math.maxInt(u64), .reordering = reordering }; for (numbers, 0..) |n, i| { t.arrived(n, true, false, 0, f); out[i] = t.due(0, f); if (out[i]) t.sent(); }}
test "draft-ietf-quic-ack-frequency-14 6.2.1: Table 1, reordering threshold 3" { const received = [_]u64{ 0, 1, 3, 4, 5, 8, 9, 10 }; const expected = [_]bool{ false, false, false, false, true, false, true, true }; var got: [received.len]bool = undefined; reorderingAcks(3, &received, &got); try testing.expectEqualSlices(bool, &expected, &got);}
test "draft-ietf-quic-ack-frequency-14 6.2.1: Table 2, reordering threshold 5" { const received = [_]u64{ 0, 1, 3, 5, 6, 7, 8, 9 }; const expected = [_]bool{ false, false, false, false, false, true, false, true }; var got: [received.len]bool = undefined; reorderingAcks(5, &received, &got); try testing.expectEqualSlices(bool, &expected, &got);}
test "draft-ietf-quic-ack-frequency-14 6: more than the threshold, or the delay, and an ACK is due" { var t: Tracker = .{}; const f: Frequency = .{ .threshold = 3, .max_delay = 1000, .reordering = 0 }; // Without an ACK_FREQUENCY, every ack-eliciting packet is owed an ACK. t.arrived(0, true, false, 10, null); try testing.expect(t.due(10, null)); t.sent();
for (1..4) |n| { t.arrived(n, true, false, 20, f); try testing.expect(!t.due(20, f)); } t.arrived(4, true, false, 20, f); // the fourth: more than three try testing.expect(t.due(20, f)); t.sent();
// One packet, then the delay runs out. t.arrived(5, true, false, 100, f); try testing.expectEqual(@as(?u64, 1100), t.deadline(f)); try testing.expect(!t.due(1099, f)); try testing.expect(t.due(1100, f)); // A packet that elicits nothing starts no clock. t.sent(); t.arrived(6, false, false, 2000, f); try testing.expect(!t.due(1_000_000, f)); try testing.expect(t.deadline(f) == null);}
test "draft-ietf-quic-ack-frequency-14 6.3: the first CE mark is acknowledged at once, not every one" { var t: Tracker = .{}; const f: Frequency = .{ .threshold = 10, .max_delay = std.math.maxInt(u64), .reordering = 0 }; t.arrived(0, true, false, 0, f); try testing.expect(!t.due(0, f)); t.arrived(1, true, true, 0, f); try testing.expect(t.due(0, f)); t.sent(); // Still CE: no transition, so nothing at once. t.arrived(2, true, true, 0, f); try testing.expect(!t.due(0, f));}
test "draft-ietf-quic-ack-frequency-14 4: a reordering threshold of zero never hurries an ACK" { var t: Tracker = .{}; const f: Frequency = .{ .threshold = 10, .max_delay = std.math.maxInt(u64), .reordering = 0 }; for ([_]u64{ 0, 5, 2, 9 }) |n| t.arrived(n, true, false, 0, f); try testing.expect(!t.due(0, f));}