Streaming: Fix retransmission time (ticket #2709)

Remove unneeded checks on RTO max/min
Return new value from doubleRTO() (prep for ticket #2715)
This commit is contained in:
zzz
2020-04-11 17:04:55 +00:00
parent 828311a24f
commit 5e00bc6510
4 changed files with 16 additions and 8 deletions

View File

@ -421,8 +421,6 @@ class Connection {
} }
long timeout = _options.getRTO(); long timeout = _options.getRTO();
if (timeout > MAX_RESEND_DELAY)
timeout = MAX_RESEND_DELAY;
if (_log.shouldLog(Log.DEBUG)) if (_log.shouldLog(Log.DEBUG))
_log.debug("Resend in " + timeout + " for " + packet); _log.debug("Resend in " + timeout + " for " + packet);
@ -1579,9 +1577,7 @@ class Connection {
} else { } else {
//long timeout = _options.getResendDelay() << numSends; //long timeout = _options.getResendDelay() << numSends;
long rto = _options.getRTO(); long rto = _options.getRTO();
if (rto < MIN_RESEND_DELAY) long timeout = rto << (numSends-2);
rto = MIN_RESEND_DELAY;
long timeout = rto << (numSends-1);
if ( (timeout > MAX_RESEND_DELAY) || (timeout <= 0) ) if ( (timeout > MAX_RESEND_DELAY) || (timeout <= 0) )
timeout = MAX_RESEND_DELAY; timeout = MAX_RESEND_DELAY;
// set this before enqueue() as it passes it on to the router // set this before enqueue() as it passes it on to the router

View File

@ -599,6 +599,9 @@ class ConnectionOptions extends I2PSocketOptionsImpl {
} }
} }
/**
* @return Connection.MIN_RESEND_DELAY to Connection.MAX_RESEND_DELAY
*/
public synchronized int getRTO() { return _rto; } public synchronized int getRTO() { return _rto; }
/** used in TCB @since 0.9.8 */ /** used in TCB @since 0.9.8 */
@ -642,13 +645,15 @@ class ConnectionOptions extends I2PSocketOptionsImpl {
* Double the RTO (after congestion). * Double the RTO (after congestion).
* See RFC 6298 section 5 item 5.5 * See RFC 6298 section 5 item 5.5
* *
* @return new value, Connection.MIN_RESEND_DELAY to Connection.MAX_RESEND_DELAY
* @since 0.9.33 * @since 0.9.33
*/ */
synchronized void doubleRTO() { synchronized int doubleRTO() {
// we don't need to switch on _initState, _rto is set in constructor // we don't need to switch on _initState, _rto is set in constructor
_rto *= 2; _rto *= 2;
if (_rto > Connection.MAX_RESEND_DELAY) if (_rto > Connection.MAX_RESEND_DELAY)
_rto = (int)Connection.MAX_RESEND_DELAY; _rto = (int)Connection.MAX_RESEND_DELAY;
return _rto;
} }
/** /**
@ -707,8 +712,9 @@ class ConnectionOptions extends I2PSocketOptionsImpl {
* @return ACK delay in ms * @return ACK delay in ms
*/ */
public int getSendAckDelay() { return _sendAckDelay; } public int getSendAckDelay() { return _sendAckDelay; }
/** /**
* Unused except here, so expect the default initial delay of 2000 ms unless set by the user * Unused except here, so expect the default initial delay of DEFAULT_INITIAL_ACK_DELAY unless set by the user
* to remain constant. * to remain constant.
*/ */
public void setSendAckDelay(int delayMs) { _sendAckDelay = delayMs; } public void setSendAckDelay(int delayMs) { _sendAckDelay = delayMs; }

View File

@ -1,3 +1,9 @@
2020-04-10 zzz
* Streaming: Fix retransmission time (ticket #2709)
2020-04-10 zzz
* Jetty: Add GzipHandler for eepsites on Jetty 9.3/9.4 (ticket #2599)
2020-04-08 zzz 2020-04-08 zzz
* i2psnark: Give peers preference to get first pieces (ticket #2473) * i2psnark: Give peers preference to get first pieces (ticket #2473)
* NetDB: Remove class M from auto-floodfill * NetDB: Remove class M from auto-floodfill

View File

@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */ /** deprecated */
public final static String ID = "Monotone"; public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION; public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 7; public final static long BUILD = 8;
/** for example "-test" */ /** for example "-test" */
public final static String EXTRA = ""; public final static String EXTRA = "";