Changes between Initial Version and Version 1 of Ticket #2443, comment 3


Ignore:
Timestamp:
Feb 26, 2019 3:36:48 PM (12 months ago)
Author:
Zlatin Balevsky
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #2443, comment 3

    initial v1  
    11Here is an updated patch which tries to measure RTT from the establishment phase and carry it over into !PeerState:
     2
     3Edit: patch updated to not initialize to -1
    24
    35{{{
     
    79# patch "router/java/src/net/i2p/router/transport/udp/ACKSender.java"
    810#  from [7fde4315c7a18dbb4ca1fcb42a3f50088931e588]
    9 #    to [15889c4510ae0b146aaeb953eeb02af2325b9788]
     11#    to [a6a1dc4bac5263da343e650c9bf5af495489e397]
    1012#
    1113# patch "router/java/src/net/i2p/router/transport/udp/EstablishmentManager.java"
     
    1517# patch "router/java/src/net/i2p/router/transport/udp/InboundEstablishState.java"
    1618#  from [c746bfee971f5ea0f6bb944120177c0e2df7afb9]
    17 #    to [8481d5b8342945fa9a83e2f2413cb9193ffab4a0]
     19#    to [1d55813e913298397a90adacaafbda7b35108c42]
    1820#
    1921# patch "router/java/src/net/i2p/router/transport/udp/OutboundEstablishState.java"
     
    2325# patch "router/java/src/net/i2p/router/transport/udp/PeerState.java"
    2426#  from [8da5f77c8ec62803af2f12a5efe2b18d79ada9d1]
    25 #    to [6135ac02d819bf14d4269d5f71e934136cd43ec6]
     27#    to [b38a05ce29d14485fc4fa2a7e77100620193aac7]
    2628#
    2729# patch "router/java/src/net/i2p/router/transport/udp/UDPTransport.java"
     
    3133============================================================
    3234--- router/java/src/net/i2p/router/transport/udp/ACKSender.java 7fde4315c7a18dbb4ca1fcb42a3f50088931e588
    33 +++ router/java/src/net/i2p/router/transport/udp/ACKSender.java 15889c4510ae0b146aaeb953eeb02af2325b9788
     35+++ router/java/src/net/i2p/router/transport/udp/ACKSender.java a6a1dc4bac5263da343e650c9bf5af495489e397
    3436@@ -62,7 +62,7 @@ class ACKSender implements Runnable {
    3537     
     
    3739         _alive = false;
    3840-        PeerState poison = new PeerState(_context, _transport, new byte[4], 0, null, false);
    39 +        PeerState poison = new PeerState(_context, _transport, new byte[4], 0, null, false, -1);
     41+        PeerState poison = new PeerState(_context, _transport, new byte[4], 0, null, false, 0);
    4042         poison.setTheyRelayToUsAs(POISON_PS);
    4143         _peersToACK.offer(poison);
     
    6466============================================================
    6567--- router/java/src/net/i2p/router/transport/udp/InboundEstablishState.java     c746bfee971f5ea0f6bb944120177c0e2df7afb9
    66 +++ router/java/src/net/i2p/router/transport/udp/InboundEstablishState.java     8481d5b8342945fa9a83e2f2413cb9193ffab4a0
     68+++ router/java/src/net/i2p/router/transport/udp/InboundEstablishState.java     1d55813e913298397a90adacaafbda7b35108c42
    6769@@ -64,6 +64,8 @@ class InboundEstablishState {
    6870     private int _createdSentCount;
     
    7072     private boolean _introductionRequested = true;
    7173+
    72 +    private int _rtt = -1;
     74+    private int _rtt;
    7375     
    7476     public enum InboundState {
     
    127129============================================================
    128130--- router/java/src/net/i2p/router/transport/udp/PeerState.java 8da5f77c8ec62803af2f12a5efe2b18d79ada9d1
    129 +++ router/java/src/net/i2p/router/transport/udp/PeerState.java 6135ac02d819bf14d4269d5f71e934136cd43ec6
     131+++ router/java/src/net/i2p/router/transport/udp/PeerState.java b38a05ce29d14485fc4fa2a7e77100620193aac7
    130132@@ -314,10 +314,10 @@ public class PeerState {
    131133      */
     
    138140+    private static final int MIN_RTO = 1000;
    139141+    private static final int INIT_RTO = 1000;
    140 +    public static final int INIT_RTT = -1;
     142+    public static final int INIT_RTT = 0;
    141143+    private static final int MAX_RTO = 60*1000;
    142144     private static final int CLOCK_SKEW_FUDGE = (ACKSender.ACK_FREQUENCY * 2) / 3;
     
    160162         _rtt = INIT_RTT;
    161163-        _rttDeviation = _rtt;
    162 +       if (rtt >= 0) 
     164+       if (rtt > 0) 
    163165+            recalculateTimeouts(rtt);
    164166+       else
     
    174176-        // the rttDev calculation matches that recommended in RFC 2988 (beta = 1/4)
    175177-        _rttDeviation = _rttDeviation + (int)(0.25d*(Math.abs(lifetime-_rtt)-_rttDeviation));
    176 +        if (_rtt == -1) {
     178+        if (_rtt <= 0) {
    177179+           // first measurement
    178180+           _rtt = (int) lifetime;
     
    224226                 continue; // Big RTT makes for a poor calculation
    225227             skews.addElement(Long.valueOf(peer.getClockSkew() / 1000));
    226          }
    227 
    228228}}}