Changeset e105ca9


Ignore:
Timestamp:
Jan 22, 2009 6:25:30 PM (12 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
9885779
Parents:
10e2c38
Message:

Bundle a reply when we switch tunnels, to detect failure sooner

File:
1 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/message/OutboundClientMessageOneShotJob.java

    r10e2c38 re105ca9  
    6262    private TunnelInfo _outTunnel;
    6363    private TunnelInfo _inTunnel;
     64    private boolean _wantACK;
    6465   
    6566    /**
     
    280281                getContext().statManager().addRateData("client.leaseSetFoundRemoteTime", lookupTime, lookupTime);
    281282            }
     283            _wantACK = false;
    282284            boolean ok = getNextLease();
    283285            if (ok) {
     
    413415        if (_log.shouldLog(Log.INFO))
    414416            _log.info("Added to cache - lease for " + _toString);
     417        _wantACK = true;
    415418        return true;
    416419    }
     
    456459            return;
    457460        }
    458         boolean wantACK = true;
     461
    459462        int existingTags = GarlicMessageBuilder.estimateAvailableTags(getContext(), _leaseSet.getEncryptionKey());
     463        _outTunnel = selectOutboundTunnel(_to);
    460464        // what's the point of 5% random? possible improvements or replacements:
    461         // - wantACK if we changed their inbound lease
    462         // - wantACK if we changed our outbound tunnel (requires moving selectOutboundTunnel() before this)
     465        // - wantACK if we changed their inbound lease (getNextLease() sets _wantACK)
     466        // - wantACK if we changed our outbound tunnel (selectOutboundTunnel() sets _wantACK)
    463467        // - wantACK if we haven't in last 1m (requires a new static cache probably)
    464         if ( (existingTags > 30) && (getContext().random().nextInt(100) >= 5) )
    465             wantACK = false;
     468        boolean wantACK = _wantACK || existingTags <= 30 || getContext().random().nextInt(100) < 5;
    466469       
    467470        PublicKey key = _leaseSet.getEncryptionKey();
     
    520523                       + _lease.getGateway().toBase64());
    521524       
    522         _outTunnel = selectOutboundTunnel(_to);
    523525        if (_outTunnel != null) {
    524526            if (_log.shouldLog(Log.DEBUG))
     
    735737                        _backloggedTunnelCache.remove(hashPair());
    736738                        _tunnelCache.put(hashPair(), tunnel);
     739                        _wantACK = true;
    737740                        return tunnel;
    738741                    }  // else still backlogged
     
    757760            if (tunnel != null)
    758761                _tunnelCache.put(hashPair(), tunnel);
     762            _wantACK = true;
    759763        }
    760764        return tunnel;
Note: See TracChangeset for help on using the changeset viewer.