Skip to content

Commit

Permalink
Merge branch 'reduce-minimum-retransmission-timeout-to-be-fitting-for…
Browse files Browse the repository at this point in the history
…-within-country-transfer' into next
  • Loading branch information
ArneBab committed Feb 5, 2025
2 parents 0b1624e + cb4221e commit 19f9aec
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/freenet/node/PeerNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -4105,7 +4105,7 @@ public static boolean shouldThrottle(Peer peer, Node node) {
}

static final long MAX_RTO = SECONDS.toMillis(60);
static final long MIN_RTO = SECONDS.toMillis(1);
static final long MIN_RTO = 50;
private int consecutiveRTOBackoffs;

// Clock generally has 20ms granularity or better, right?
Expand Down Expand Up @@ -4135,19 +4135,19 @@ public void reportPing(long t) {
reportedRTT = true;
if(logMINOR) Logger.minor(this, "Received first packet on "+shortToString()+" setting RTO to "+RTO);
if(oldRTO > RTO) {
// We have backed off
// After resetting RTO and starting from scratch,
// RTO is lower again, so the old time may have
// been inflated by temorary failure.
if(logMINOR) Logger.minor(this, "Received first packet after backing off on resend. RTO is "+RTO+" but was "+oldRTO);
// FIXME: do something???
}
} else {
// Update
RTTVAR = 0.75 * RTTVAR + 0.25 * Math.abs(SRTT - t);
SRTT = 0.875 * SRTT + 0.125 * t;
RTO = SRTT + Math.max(CLOCK_GRANULARITY, RTTVAR * 4);
// RFC 2988 specifies a 1 second minimum RTT, mostly due to legacy issues,
// but given that Freenet is mostly used on very slow upstream links, it
// probably makes sense for us too for now, to avoid excessive retransmits.
// FIXME !!!
// but given that ping times inside a country (where we expect most friend-connections)
// are at a max of 50ms in 2025, we use 50ms to reduce the effect of packet loss.
if(RTO < MIN_RTO)
RTO = MIN_RTO;
if(RTO > MAX_RTO)
Expand Down

0 comments on commit 19f9aec

Please sign in to comment.