Round down retransmit size
Opened 7 months ago
#2782newdefect
Round down retransmit size
Reported by:zzzOwned by: Priority: minor Milestone: undecided Component: streaming Version: 0.9.47 Keywords:
Cc: zlatinb Parent Tickets:
Sensitive: no
Description
In #2713 we concluded we should round down the (messages / 2) calculation to strictly be less than or equal to half, as specified in the RFCs.
In streaming we round up. Proposed fix:
--- apps/streaming/java/src/net/i2p/client/streaming/impl/Connection.java cf41a5a2d017502744badbd174cc1533871fae72
+++ apps/streaming/java/src/net/i2p/client/streaming/impl/Connection.java 60f311c939455510182d9b8038e844d2065cdab4
@@ -1503,7 +1503,8 @@ class Connection {
_log.debug(Connection.this + " not cutting ssthresh and window");
toResend = new ArrayList<>(_outboundPackets.values());
- toResend = toResend.subList(0, Math.min(MAX_RTX, (toResend.size() + 1) / 2));
+ // round down (RFC 5681 section 4.3 "MUST be no more than half")
+ toResend = toResend.subList(0, Math.max(1, Math.min(MAX_RTX, toResend.size() / 2)));
}
// 3. Retransmit up to half of the packets in flight (RFC 6298 section 5.4 and RFC 5681 section 4.3)