From 68273cd256a1a6ec7e7a9a899ee46c4a0f8ce02a Mon Sep 17 00:00:00 2001 From: zzz <zzz@i2pmail.org> Date: Sat, 26 Mar 2022 07:04:49 -0400 Subject: [PATCH] SSU2: Reduce ack delay, see MR !57 See previous checkin for SSU 1. This change dramatically reduces the measured RTT to get it much closer to the real RTT by reducing the ack delay. With the ack delay dependent on the measured RTT, the measured RTT will increase. Simulation results: For a denominator D in the ack delay calculation (currently 2) and a true RTT = TRTT: For D <= about 2, measured RTT -> TRTT + 2 * TRTT/D For D >= about 4, measured RTT -> TRTT + TRTT/D In other words, for D == 2, measured RTT -> 2 * TRTT. For a TRTT of 50, the measured RTT is 100. D == 2 is too small. It's been like that since 2005. Testnet results: measured RTT 80-90 This changes D to 6. measured RTT -> 6/5 * TRTT. Simulation results: For a TRTT of 50, the measured RTT is 58. Testnet results: measured RTT 60 --- router/java/src/net/i2p/router/transport/udp/PeerState2.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/router/java/src/net/i2p/router/transport/udp/PeerState2.java b/router/java/src/net/i2p/router/transport/udp/PeerState2.java index 9aff6ac075..46a7787edf 100644 --- a/router/java/src/net/i2p/router/transport/udp/PeerState2.java +++ b/router/java/src/net/i2p/router/transport/udp/PeerState2.java @@ -649,7 +649,7 @@ public class PeerState2 extends PeerState implements SSU2Payload.PayloadCallback private class ACKTimer extends SimpleTimer2.TimedEvent { public ACKTimer() { super(_context.simpleTimer2()); - long delta = Math.min(_rtt/2, ACK_FREQUENCY); + long delta = Math.max(10, Math.min(_rtt/6, ACK_FREQUENCY)); if (_log.shouldDebug()) _log.debug("Sending delayed ack in " + delta + ": " + PeerState2.this); schedule(delta); -- GitLab