Changeset b9aceb8


Ignore:
Timestamp:
Sep 12, 2012 9:55:15 PM (8 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
68ccb3a
Parents:
8633ef9
Message:
  • SSU:
    • Increase initial and max RTO
    • Don't count ack-only packets in bandwidth allocation
    • Unused method cleanup
Location:
router/java/src/net/i2p/router/transport/udp
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/transport/udp/ACKSender.java

    r8633ef9 rb9aceb8  
    179179                    if (_log.shouldLog(Log.INFO))
    180180                        _log.info("Sending ACK for " + ackBitfields);
    181                     peer.allocateSendingBytes(ack.getPacket().getLength(), true);
     181                    // locking issues, we ignore the result, and acks are small,
     182                    // so don't even bother allocating
     183                    //peer.allocateSendingBytes(ack.getPacket().getLength(), true);
    182184                    // ignore whether its ok or not, its a bloody ack.  this should be fixed, probably.
    183185                    _transport.send(ack);
  • router/java/src/net/i2p/router/transport/udp/PeerState.java

    r8633ef9 rb9aceb8  
    5656     */
    5757    private SessionKey _nextCipherKey;
     58
    5859    /**
    5960     * The keying material used for the rekeying, or null if we are not in
    6061     * the process of rekeying.
    6162     */
    62     private byte[] _nextKeyingMaterial;
     63    //private byte[] _nextKeyingMaterial;
    6364    /** true if we began the current rekeying, false otherwise */
    64     private boolean _rekeyBeganLocally;
     65    //private boolean _rekeyBeganLocally;
     66
    6567    /** when were the current cipher and MAC keys established/rekeyed? */
    6668    private long _keyEstablishedTime;
     
    8284    /** how many consecutive messages have we sent and not received an ACK to */
    8385    private int _consecutiveFailedSends;
     86
    8487    /** when did we last have a failed send (beginning of period) */
    8588    // private long _lastFailedSendPeriod;
     
    110113     * the previous second's ACKs be sent?
    111114     */
    112     private boolean _remoteWantsPreviousACKs;
     115    //private boolean _remoteWantsPreviousACKs;
    113116    /** how many bytes should we send to the peer in a second */
    114117    private volatile int _sendWindowBytes;
     
    142145
    143146    /** if we need to contact them, do we need to talk to an introducer? */
    144     private boolean _remoteRequiresIntroduction;
     147    //private boolean _remoteRequiresIntroduction;
     148
    145149    /**
    146150     * if we are serving as an introducer to them, this is the the tag that
     
    180184    /** how many packets were retransmitted within the last RETRANSMISSION_PERIOD_WIDTH packets */
    181185    private long _packetsRetransmitted;
     186
    182187    /** how many packets were transmitted within the last RETRANSMISSION_PERIOD_WIDTH packets */
    183     private long _packetsPeriodTransmitted;
    184     private int _packetsPeriodRetransmitted;
    185     private int _packetRetransmissionRate;
     188    //private long _packetsPeriodTransmitted;
     189    //private int _packetsPeriodRetransmitted;
     190    //private int _packetRetransmissionRate;
     191
    186192    /** how many dup packets were received within the last RETRANSMISSION_PERIOD_WIDTH packets */
    187193    private long _packetsReceivedDuplicate;
     
    280286   
    281287    private static final int MIN_RTO = 100 + ACKSender.ACK_FREQUENCY;
    282     private static final int MAX_RTO = 3000; // 5000;
     288    private static final int INIT_RTO = 4*1000;
     289    private static final int MAX_RTO = 15*1000;
    283290   
    284291    public PeerState(RouterContext ctx, UDPTransport transport,
     
    302309        _remotePort = remotePort;
    303310        _mtu = DEFAULT_MTU;
    304         _mtuReceive = _mtu;
     311        _mtuReceive = DEFAULT_MTU;
    305312        _largeMTU = transport.getMTU();
    306313        //_mtuLastChecked = -1;
    307314        _lastACKSend = -1;
    308         _rto = MIN_RTO;
    309         _rtt = _rto/2;
     315        _rto = INIT_RTO;
     316        _rtt = INIT_RTO / 2;
    310317        _rttDeviation = _rtt;
    311318        _inboundMessages = new HashMap(8);
     
    352359     * The keying material used for the rekeying, or null if we are not in
    353360     * the process of rekeying.
    354      * @deprecated unused
    355      */
    356     public byte[] getNextKeyingMaterial() { return _nextKeyingMaterial; }
     361     * deprecated unused
     362     */
     363    //public byte[] getNextKeyingMaterial() { return _nextKeyingMaterial; }
    357364
    358365    /** true if we began the current rekeying, false otherwise */
    359     public boolean getRekeyBeganLocally() { return _rekeyBeganLocally; }
     366    //public boolean getRekeyBeganLocally() { return _rekeyBeganLocally; }
     367
    360368    /** when were the current cipher and MAC keys established/rekeyed? */
    361369    public long getKeyEstablishedTime() { return _keyEstablishedTime; }
     
    383391     * the previous second's ACKs be sent?
    384392     */
    385     public boolean getRemoteWantsPreviousACKs() { return _remoteWantsPreviousACKs; }
     393    //public boolean getRemoteWantsPreviousACKs() { return _remoteWantsPreviousACKs; }
    386394    /** how many bytes should we send to the peer in a second */
    387395    public int getSendWindowBytes() { return _sendWindowBytes; }
     
    410418
    411419    /** if we need to contact them, do we need to talk to an introducer? */
    412     public boolean getRemoteRequiresIntroduction() { return _remoteRequiresIntroduction; }
     420    //public boolean getRemoteRequiresIntroduction() { return _remoteRequiresIntroduction; }
    413421
    414422    /**
     
    476484     * @deprecated unused
    477485     */
    478     public void setNextKeyingMaterial(byte data[]) { _nextKeyingMaterial = data; }
     486    //public void setNextKeyingMaterial(byte data[]) { _nextKeyingMaterial = data; }
    479487
    480488    /**
     
    482490     * @deprecated unused
    483491     */
    484     public void setRekeyBeganLocally(boolean local) { _rekeyBeganLocally = local; }
     492    //public void setRekeyBeganLocally(boolean local) { _rekeyBeganLocally = local; }
    485493
    486494    /**
     
    537545     * the previous second's ACKs be sent?
    538546     */
    539     public void remoteDoesNotWantPreviousACKs() { _remoteWantsPreviousACKs = false; }
     547    //public void remoteDoesNotWantPreviousACKs() { _remoteWantsPreviousACKs = false; }
    540548   
    541549    /** should we ignore the peer state's congestion window, and let anything through? */
     
    551559     */
    552560    public boolean allocateSendingBytes(int size, int messagePushCount) { return allocateSendingBytes(size, false, messagePushCount); }
     561
    553562    public boolean allocateSendingBytes(int size, boolean isForACK) { return allocateSendingBytes(size, isForACK, -1); }
     563
     564    /**
     565     *  Caller should synch
     566     */
    554567    public boolean allocateSendingBytes(int size, boolean isForACK, int messagePushCount) {
    555568        long now = _context.clock().now();
     
    592605   
    593606    /** if we need to contact them, do we need to talk to an introducer? */
    594     public void setRemoteRequiresIntroduction(boolean required) { _remoteRequiresIntroduction = required; }
     607    //public void setRemoteRequiresIntroduction(boolean required) { _remoteRequiresIntroduction = required; }
    595608
    596609    /**
     
    10391052        if (_rto < minRTO())
    10401053            _rto = minRTO();
    1041         if (_rto > MAX_RTO)
     1054        else if (_rto > MAX_RTO)
    10421055            _rto = MAX_RTO;
    10431056    }
     
    11251138    public long getPacketsTransmitted() { return _packetsTransmitted; }
    11261139    public long getPacketsRetransmitted() { return _packetsRetransmitted; }
    1127     public long getPacketsPeriodTransmitted() { return _packetsPeriodTransmitted; }
    1128     public int getPacketsPeriodRetransmitted() { return _packetsPeriodRetransmitted; }
     1140    //public long getPacketsPeriodTransmitted() { return _packetsPeriodTransmitted; }
     1141    //public int getPacketsPeriodRetransmitted() { return _packetsPeriodRetransmitted; }
     1142
    11291143    /** avg number of packets retransmitted for every 100 packets */
    1130     public long getPacketRetransmissionRate() { return _packetRetransmissionRate; }
     1144    //public long getPacketRetransmissionRate() { return _packetRetransmissionRate; }
    11311145    public long getPacketsReceived() { return _packetsReceived; }
    11321146    public long getPacketsReceivedDuplicate() { return _packetsReceivedDuplicate; }
     
    11921206
    11931207    private int minRTO() {
    1194         if (_packetRetransmissionRate < 10)
     1208        //if (_packetRetransmissionRate < 10)
    11951209            return MIN_RTO;
    1196         else if (_packetRetransmissionRate < 50)
    1197             return 2*MIN_RTO;
    1198         else
    1199             return MAX_RTO;
     1210        //else if (_packetRetransmissionRate < 50)
     1211        //    return 2*MIN_RTO;
     1212        //else
     1213        //    return MAX_RTO;
    12001214    }
    12011215   
Note: See TracChangeset for help on using the changeset viewer.