aboutsummaryrefslogtreecommitdiffstats
path: root/examples/rto.aup
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-10-19 07:34:12 +0100
committereunhhu <[email protected]>2026-10-19 07:34:12 +0100
commit30eed7886769d838a5d51b70c764c532ca023b1c (patch)
tree38ae2b811d56c217bb4ebf0c843046390d207ecd /examples/rto.aup
parent1c3b2475ca2008b7a68e7fbd6281b59fa84a286c (diff)
downloadaup-30eed7886769d838a5d51b70c764c532ca023b1c.tar.gz
aup-30eed7886769d838a5d51b70c764c532ca023b1c.zip
140's apps written with the frictions gone: inflate's and linebreak's lists declared together, linebreak's 0x2010 and 0x25CC (their modules the same), DNS's records = [] and 0xc000, HTTP's trailers, j = fields(...), RFC 6298's abs and tick.period (G written once), layout's lists together, its boxes and root as targets together, boxes = []; lines 121 to 120, 148 to 146, 176 to 169, 116 to 110; instructions within 0.2%
Diffstat (limited to 'examples/rto.aup')
-rw-r--r--examples/rto.aup6
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/rto.aup b/examples/rto.aup
index 1d147eb..55412a7 100644
--- a/examples/rto.aup
+++ b/examples/rto.aup
@@ -23,7 +23,7 @@ input transmit = message { seq: u32 }
input ack = message { seq: u32 }
input tick = every 10 ms
-fn LOWEST = 1000; fn HIGHEST = 60000; fn PERIOD = 10 # milliseconds; the clock's granularity G is the tick's period
+fn LOWEST = 1000; fn HIGHEST = 60000 # milliseconds
on transmit {
outstanding.append(Segment { seq: transmit.seq, sent: now })
@@ -46,10 +46,10 @@ on ack {
if !measured { # 2.2
srtt, rttvar, measured = r, r / 2, true
} else { # 2.3
- rttvar = 0.75 * rttvar + 0.25 * max(srtt - r, r - srtt)
+ rttvar = 0.75 * rttvar + 0.25 * abs(srtt - r)
srtt = 0.875 * srtt + 0.125 * r
}
- rto = min(max(srtt + max(PERIOD, 4 * rttvar), LOWEST), HIGHEST) # 2.4, 2.5
+ rto = min(max(srtt + max(tick.period, 4 * rttvar), LOWEST), HIGHEST) # 2.4, 2.5 (G: the tick's period)
}
deadline = if outstanding.count > 0 { now + rto } else { -1 } # 5.3, 5.2
}