From 8071832bc7857634f66c94592b27b188c882ea54 Mon Sep 17 00:00:00 2001 From: eunhhu Date: Mon, 19 Oct 2026 05:54:45 +0100 Subject: 140's 10, RFC 6298's retransmission timer, written in aup with no new opcode (aup's examples/rto.aup, the timer a deadline in the state seen at each periodic tick): 20 scenarios (10 seeds, ticks every 10 and 100 ms; a closed loop: first sendings lost one in five, the receiver acknowledging cumulatively) and their 241,612 events right against rto.py, the model of the same rules (no known implementation takes given events), on the three paths, the paths the same; module_specs in make check: one scenario at both periods (tests/specs/rto, 2,297 events); bars: one workaround (the periodic tick: 2,795.8 ticks a timeout at 10 ms, 281.6 at 100, seen 4.27 and 49.23 ms late on average; ticks 93% and 57% of the counted work), 56 lines against Python's 30, three frictions (an input's period not readable, no abs, send a keyword); the one-shot timer's shape as a decision point, one spec needing it: noted, not made; the suite table's row 10 --- tests/check.py | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'tests/check.py') diff --git a/tests/check.py b/tests/check.py index 7a5f50e..5574b80 100644 --- a/tests/check.py +++ b/tests/check.py @@ -1736,7 +1736,9 @@ def module_specs(aup, pure, work): written back by its view to the same records, cut ones refused; HTTP/1.1 request streams (tests/specs/http) read by its examples/http.aup a packet at a time, cut anywhere, to the same requests; line breaking (UAX #14) by its - examples/linebreak.aup on LineBreakTest.txt's lines (tests/specs/linebreak).""" + examples/linebreak.aup on LineBreakTest.txt's lines (tests/specs/linebreak); + RFC 6298's retransmission timer by its examples/rto.aup on a scenario's + events (tests/specs/rto), the model's state after each.""" import hashlib import os import random @@ -1962,6 +1964,30 @@ def module_specs(aup, pure, work): state = json.loads(line) assert state['fault'] == 'none' and [b != 0 for b in bytes.fromhex(state['views']['boundaries'])] == want, codes runs['linebreak'] = {'lines': len(lines), 'code_points': sum(len(c) for c, _ in lines)} + # RFC 6298's retransmission timer (its examples/rto.aup, ticked): a scenario's sends, acknowledgements and ticks + # (tests/specs/rto, at periods of 10 and 100 ms), after each the model's SRTT, RTTVAR, RTO, deadline and counts. + source, events = (EXAMPLES / 'rto.aup').read_text(), 0 + for scenario in json.loads((pure / 'tests/specs/rto/scenarios.json').read_text()): + period = scenario['period'] + (work / 'rto.aup').write_text(source.replace('every 10 ms', f'every {period} ms').replace('fn PERIOD = 10 ', f'fn PERIOD = {period} ')) + program = work / 'rto.pmod' + compile_module(aup, work / 'rto.aup', program) + given = ''.join(f'time {t}\n' + ('tick tick\n' if kind == 'tick' else f"message {kind} {struct.pack('