Changeset 772d0be for apps/streaming


Ignore:
Timestamp:
Apr 23, 2015 3:34:24 PM (5 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
37c6ac3
Parents:
64fdfd8
Message:

Streaming: Don't wait too long to send a dup ACK, so the other
side isn't stuck forever at a window size of 1.
Cleanups, log tweaks, javadocs

Location:
apps/streaming/java/src/net/i2p/client/streaming/impl
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • apps/streaming/java/src/net/i2p/client/streaming/impl/ConnectionOptions.java

    r64fdfd8 r772d0be  
    547547     */
    548548    public synchronized int getRTT() { return _rtt; }
    549     public void setRTT(int ms) {
     549
     550    /**
     551     *  not public, use updateRTT()
     552     */
     553    private void setRTT(int ms) {
    550554        synchronized (_trend) {
    551555            _trend[0] = _trend[1];
     
    570574    /** used in TCB @since 0.9.8 */
    571575    synchronized int getRTTDev() { return _rttDev; }
     576
    572577    private synchronized void setRTTDev(int rttDev) { _rttDev = rttDev; }
    573578   
     
    620625    }
    621626   
     627    /**
     628     *  @param measuredValue must be positive
     629     */
    622630    public synchronized void updateRTT(int measuredValue) {
    623631        switch(_initState) {
  • apps/streaming/java/src/net/i2p/client/streaming/impl/ConnectionPacketHandler.java

    r64fdfd8 r772d0be  
    195195                                    con, packet, ackDelay, DataHelper.formatDuration(now - lastSendTime)));
    196196               
    197                 final long nextSendTime = lastSendTime + ackDelay;
     197                // If this is longer than his RTO, he will always retransmit, and
     198                // will be stuck at a window size of 1 forever. So we take the minimum
     199                // of the ackDelay and half our estimated RTT to be sure.
     200                final long nextSendTime = lastSendTime + Math.min(ackDelay, con.getOptions().getRTT() / 2);
    198201                if (nextSendTime <= now) {
    199202                    if (_log.shouldLog(Log.DEBUG))
     
    204207                    final long delay = nextSendTime - now;
    205208                    if (_log.shouldLog(Log.DEBUG))
    206                         _log.debug("scheduling ack in "+delay);
     209                        _log.debug("scheduling ack in " + delay);
    207210                    _context.simpleTimer2().addEvent(new AckDup(con), delay);
    208211                }
  • apps/streaming/java/src/net/i2p/client/streaming/impl/PacketHandler.java

    r64fdfd8 r772d0be  
    115115    private static final SimpleDateFormat _fmt = new SimpleDateFormat("HH:mm:ss.SSS");
    116116
    117     /** logs to System.out, and router log at debug level */
     117    /** logs to router log at debug level */
    118118    void displayPacket(Packet packet, String prefix, String suffix) {
    119119        StringBuilder buf = new StringBuilder(256);
     
    126126            buf.append(" ").append(suffix);
    127127        String str = buf.toString();
    128         System.out.println(str);
     128        //System.out.println(str);
    129129        _log.debug(str);
    130130    }
Note: See TracChangeset for help on using the changeset viewer.