Changes between Version 1 and Version 2 of Ticket #2443, comment 1


Ignore:
Timestamp:
Feb 19, 2019 2:54:02 AM (12 months ago)
Author:
Zlatin Balevsky
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #2443, comment 1

    v1 v2  
    1 A very simple patch that addresses both issues above:
     1A patch that addresses above issues plus some others:
    22
    33{{{
     
    77# patch "router/java/src/net/i2p/router/transport/udp/PeerState.java"
    88#  from [8da5f77c8ec62803af2f12a5efe2b18d79ada9d1]
    9 #    to [455ac060fc8d77c975167c3cdf46aa7d97be5757]
     9#    to [f229219bbe0181123fb99cc74483a86c012740c9]
    1010#
    1111# patch "router/java/src/net/i2p/router/transport/udp/UDPTransport.java"
     
    1515============================================================
    1616--- router/java/src/net/i2p/router/transport/udp/PeerState.java 8da5f77c8ec62803af2f12a5efe2b18d79ada9d1
    17 +++ router/java/src/net/i2p/router/transport/udp/PeerState.java 455ac060fc8d77c975167c3cdf46aa7d97be5757
    18 @@ -315,8 +315,8 @@ public class PeerState {
     17+++ router/java/src/net/i2p/router/transport/udp/PeerState.java f229219bbe0181123fb99cc74483a86c012740c9
     18@@ -314,10 +314,10 @@ public class PeerState {
     19      */
    1920     public static final int MAX_MTU = Math.max(LARGE_MTU, MAX_IPV6_MTU);
    2021     
    21      private static final int MIN_RTO = 100 + ACKSender.ACK_FREQUENCY;
     22-    private static final int MIN_RTO = 100 + ACKSender.ACK_FREQUENCY;
    2223-    private static final int INIT_RTO = 3*1000;
    2324-    public static final int INIT_RTT = INIT_RTO / 2;
     25-    private static final int MAX_RTO = 15*1000;
     26+    private static final int MIN_RTO = 1000;
    2427+    private static final int INIT_RTO = 1000;
    2528+    public static final int INIT_RTT = -1;
    26      private static final int MAX_RTO = 15*1000;
     29+    private static final int MAX_RTO = 60*1000;
    2730     private static final int CLOCK_SKEW_FUDGE = (ACKSender.ACK_FREQUENCY * 2) / 3;
    2831     
    29 @@ -1226,16 +1226,22 @@ public class PeerState {
     32     /**
     33@@ -1226,16 +1226,18 @@ public class PeerState {
    3034      *  Caller should synch on this
    3135      */
     
    3943+       } else {
    4044+            // the rttDev calculation matches that recommended in RFC 2988 (beta = 1/4)
    41 +            _rttDeviation = _rttDeviation + (int)(0.25d*(Math.abs(lifetime-_rtt)-_rttDeviation));
     45+            _rttDeviation = (int)( 0.75*_rttDeviation + 0.25*Math.abs(lifetime-_rtt) );
    4246         
    4347-        float scale = RTT_DAMPENING;
     
    4751-        //if (scale < 0.001f) scale = 0.001f;
    4852+            float scale = RTT_DAMPENING;
    49 +            // the faster we are going, the slower we want to reduce the rtt
    50 +            //if (_sendBps > 0)
    51 +            //    scale = lifetime / ((float)lifetime + (float)_sendBps);
    52 +            //if (scale < 0.001f) scale = 0.001f;
    5353         
    5454-        _rtt = (int)(_rtt*(1.0f-scale) + (scale)*lifetime);
     
    5858         _rto = Math.min(MAX_RTO, Math.max(minRTO(), _rtt + (_rttDeviation<<2)));
    5959         //if (_log.shouldLog(Log.DEBUG))
     60@@ -1821,13 +1823,15 @@ public class PeerState {
     61                               + " remaining"
     62                               + " for message " + state.getMessageId() + ": " + state);
     63 
     64-                if (state.getPushCount() > 0)
     65+                int rto = getRTO();
     66+                if (state.getPushCount() > 0) {
     67                     _retransmitter = state;
     68+                   rto = Math.min(MAX_RTO, rto << state.getPushCount()); // Section 5.5 RFC 6298
     69+               }
     70 
     71                 if (state.push())
     72                     _messagesSent++;
     73             
     74-                int rto = getRTO();
     75                 state.setNextSendTime(now + rto);
     76 
     77                 //if (peer.getSendWindowBytesRemaining() > 0)
    6078============================================================
    6179--- router/java/src/net/i2p/router/transport/udp/UDPTransport.java      571355e1913c9c64726d6c5cd7e16c771b671548