Changeset 50d038a


Ignore:
Timestamp:
Mar 1, 2016 1:30:30 PM (4 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
1f088ff
Parents:
ffa4d65
Message:

NetDb?: Search for new leaseset before expiration
Reduce expiration for router infos with introducers
More negative cache checks
Log tweaks
SSU: Switch introducers less often

Files:
8 edited

Legend:

Unmodified
Added
Removed
  • history.txt

    rffa4d65 r50d038a  
     12016-03-01 zzz
     2 * i2psnark: Fix handling of HAVE messages received before metainfo
     3 * i2ptunnel: Don't default to a private key file that exists (ticket #1628)
     4 * NetDb:
     5   - Search for new leaseset before expiration;
     6   - Reduce expiration for router infos with introducers
     7   - Add missing reseed cert
     8 * SSU: Switch introducers less often
     9
    1102016-02-26 zzz
    211 * Console:
     
    918 * Router: Log full path to wrapper.log when dumping threads
    1019 * Transports: Increase connection limits for class N and higher
     20 * Utils: Add main classes to i2p.jar and router.jar
     21   for simple command line access to utilities
    1122
    12232016-02-22 zzz
  • router/java/src/net/i2p/router/NetworkDatabaseFacade.java

    rffa4d65 r50d038a  
    5353    public abstract void lookupRouterInfo(Hash key, Job onFindJob, Job onFailedLookupJob, long timeoutMs);
    5454    public abstract RouterInfo lookupRouterInfoLocally(Hash key);
     55   
     56    /**
     57     *  Unconditionally lookup using the client's tunnels.
     58     *  No success or failed jobs, no local lookup, no checks.
     59     *  Use this to refresh a leaseset before expiration.
     60     *
     61     *  @param fromLocalDest use these tunnels for the lookup, or null for exploratory
     62     *  @since 0.9.25
     63     */
     64    public abstract void lookupLeaseSetRemotely(Hash key, Hash fromLocalDest);
    5565
    5666    /**
  • router/java/src/net/i2p/router/RouterVersion.java

    rffa4d65 r50d038a  
    1919    public final static String ID = "Monotone";
    2020    public final static String VERSION = CoreVersion.VERSION;
    21     public final static long BUILD = 9;
     21    public final static long BUILD = 10;
    2222
    2323    /** for example "-test" */
    24     public final static String EXTRA = "";
     24    public final static String EXTRA = "-rc";
    2525    public final static String FULL_VERSION = VERSION + "-" + BUILD + EXTRA;
    2626    public static void main(String args[]) {
  • router/java/src/net/i2p/router/dummy/DummyNetworkDatabaseFacade.java

    rffa4d65 r50d038a  
    4444    public void lookupLeaseSet(Hash key, Job onFindJob, Job onFailedLookupJob, long timeoutMs, Hash fromLocalDest) {}
    4545    public LeaseSet lookupLeaseSetLocally(Hash key) { return null; }
     46    public void lookupLeaseSetRemotely(Hash key, Hash fromLocalDest) {}
    4647
    4748    public void lookupDestination(Hash key, Job onFinishedJob, long timeoutMs, Hash fromLocalDest) {}
  • router/java/src/net/i2p/router/message/OutboundClientMessageOneShotJob.java

    rffa4d65 r50d038a  
    282282            if (_log.shouldLog(Log.DEBUG))
    283283                _log.debug(getJobId() + ": Send outbound client message - leaseSet found locally for " + _toString);
     284
     285            if (!_leaseSet.isCurrent(Router.CLOCK_FUDGE_FACTOR / 4)) {
     286                // If it's about to expire, refetch in the background, we'll
     287                // probably need it again. This will prevent stalls later.
     288                // We don't know if the other end is actually publishing his LS, so this could be a waste of time.
     289                // When we move to LS2, we will have a bit that tells us if it is published.
     290                if (_log.shouldWarn()) {
     291                    long exp = now - _leaseSet.getLatestLeaseDate();
     292                    _log.warn(getJobId() + ": leaseSet expired " + DataHelper.formatDuration(exp) + " ago, firing search: " + _leaseSet.getHash().toBase32());
     293                }
     294                getContext().netDb().lookupLeaseSetRemotely(_leaseSet.getHash(), _from.calculateHash());
     295            }
     296
    284297            success.runJob();
    285298        } else {
  • router/java/src/net/i2p/router/networkdb/kademlia/FloodfillNetworkDatabaseFacade.java

    rffa4d65 r50d038a  
    344344        if (key == null) throw new IllegalArgumentException("searchin for nothin, eh?");
    345345        boolean isNew = false;
    346         FloodSearchJob searchJob = null;
     346        FloodSearchJob searchJob;
    347347        synchronized (_activeFloodQueries) {
    348348            searchJob = _activeFloodQueries.get(key);
  • router/java/src/net/i2p/router/networkdb/kademlia/KademliaNetworkDatabaseFacade.java

    rffa4d65 r50d038a  
    134134    private final static long ROUTER_INFO_EXPIRATION_SHORT = 75*60*1000l;
    135135    private final static long ROUTER_INFO_EXPIRATION_FLOODFILL = 60*60*1000l;
     136    private final static long ROUTER_INFO_EXPIRATION_INTRODUCED = 45*60*1000l;
    136137   
    137138    private final static long EXPLORE_JOB_DELAY = 10*60*1000l;
     
    494495    /**
    495496     *  Lookup using exploratory tunnels.
    496      *  Use lookupDestination() if you don't need the LS or need it validated.
     497     *  Use lookupDestination() if you don't need the LS or don't need it validated.
    497498     */
    498499    public void lookupLeaseSet(Hash key, Job onFindJob, Job onFailedLookupJob, long timeoutMs) {
     
    502503    /**
    503504     *  Lookup using the client's tunnels
    504      *  Use lookupDestination() if you don't need the LS or need it validated.
     505     *  Use lookupDestination() if you don't need the LS or don't need it validated.
    505506     *
    506507     *  @param fromLocalDest use these tunnels for the lookup, or null for exploratory
     
    512513        LeaseSet ls = lookupLeaseSetLocally(key);
    513514        if (ls != null) {
    514             if (_log.shouldLog(Log.DEBUG))
    515                 _log.debug("leaseSet found locally, firing " + onFindJob);
     515            //if (_log.shouldLog(Log.DEBUG))
     516            //    _log.debug("leaseSet found locally, firing " + onFindJob);
    516517            if (onFindJob != null)
    517518                _context.jobQueue().addJob(onFindJob);
    518519        } else if (isNegativeCached(key)) {
    519520            if (_log.shouldLog(Log.WARN))
    520                 _log.warn("Negative cached, not searching: " + key);
     521                _log.warn("Negative cached, not searching LS: " + key);
    521522            if (onFailedLookupJob != null)
    522523                _context.jobQueue().addJob(onFailedLookupJob);
    523524        } else {
    524             if (_log.shouldLog(Log.DEBUG))
    525                 _log.debug("leaseSet not found locally, running search");
     525            //if (_log.shouldLog(Log.DEBUG))
     526            //    _log.debug("leaseSet not found locally, running search");
    526527            search(key, onFindJob, onFailedLookupJob, timeoutMs, true, fromLocalDest);
    527528        }
    528         if (_log.shouldLog(Log.DEBUG))
    529             _log.debug("after lookupLeaseSet");
    530     }
    531    
    532     /**
    533      *  Use lookupDestination() if you don't need the LS or need it validated.
     529        //if (_log.shouldLog(Log.DEBUG))
     530        //    _log.debug("after lookupLeaseSet");
     531    }
     532   
     533    /**
     534     *  Unconditionally lookup using the client's tunnels.
     535     *  No success or failed jobs, no local lookup, no checks.
     536     *  Use this to refresh a leaseset before expiration.
     537     *
     538     *  @param fromLocalDest use these tunnels for the lookup, or null for exploratory
     539     *  @since 0.9.25
     540     */
     541    public void lookupLeaseSetRemotely(Hash key, Hash fromLocalDest) {
     542        if (!_initialized) return;
     543        search(key, null, null, 20*1000, true, fromLocalDest);
     544    }
     545
     546    /**
     547     *  Use lookupDestination() if you don't need the LS or don't need it validated.
    534548     */
    535549    public LeaseSet lookupLeaseSetLocally(Hash key) {
     
    572586        if (d != null) {
    573587            _context.jobQueue().addJob(onFinishedJob);
     588        } else if (isNegativeCached(key)) {
     589            if (_log.shouldLog(Log.WARN))
     590                _log.warn("Negative cached, not searching dest: " + key);
    574591        } else {
    575592            search(key, onFinishedJob, onFinishedJob, timeoutMs, true, fromLocalDest);
     
    606623            if (onFailedLookupJob != null)
    607624                _context.jobQueue().addJob(onFailedLookupJob);
     625        } else if (isNegativeCached(key)) {
     626            if (_log.shouldLog(Log.WARN))
     627                _log.warn("Negative cached, not searching RI: " + key);
    608628        } else {
    609629            search(key, onFindJob, onFailedLookupJob, timeoutMs, false);
     
    958978            return "Peer published " + DataHelper.formatDuration(age) + " in the future?!";
    959979        }
    960         if (upLongEnough && (routerInfo.getPublished() < now - 2*24*60*60*1000l) ) {
    961             long age = _context.clock().now() - routerInfo.getPublished();
    962             return "Peer published " + DataHelper.formatDuration(age) + " ago";
    963         }
    964         if (upLongEnough && !routerInfo.isCurrent(ROUTER_INFO_EXPIRATION_SHORT)) {
     980        if (!routerInfo.isCurrent(ROUTER_INFO_EXPIRATION_INTRODUCED)) {
    965981            if (routerInfo.getAddresses().isEmpty())
    966                 return "Peer published > 75m ago with no addresses";
     982                return "Old peer with no addresses";
    967983            // This should cover the introducers case below too
    968984            // And even better, catches the case where the router is unreachable but knows no introducers
    969985            if (routerInfo.getCapabilities().indexOf(Router.CAPABILITY_UNREACHABLE) >= 0)
    970                 return "Peer published > 75m ago and thinks it is unreachable";
     986                return "Old peer and thinks it is unreachable";
     987            // FIXME check all SSU addresses, not just first
    971988            RouterAddress ra = routerInfo.getTargetAddress("SSU");
    972989            if (ra != null) {
    973990                // Introducers change often, introducee will ping introducer for 2 hours
    974991                if (ra.getOption("ihost0") != null)
    975                     return "Peer published > 75m ago with SSU Introducers";
    976                 if (routerInfo.getTargetAddress("NTCP") == null)
    977                     return "Peer published > 75m ago, SSU only without introducers";
     992                    return "Old peer with SSU Introducers";
    978993            }
     994        }
     995        if (upLongEnough && (routerInfo.getPublished() < now - 2*24*60*60*1000l) ) {
     996            long age = _context.clock().now() - routerInfo.getPublished();
     997            return "Peer published " + DataHelper.formatDuration(age) + " ago";
     998        }
     999        if (upLongEnough && !routerInfo.isCurrent(ROUTER_INFO_EXPIRATION_SHORT)) {
     1000            if (routerInfo.getTargetAddress("NTCP") == null)
     1001                return "Peer published > 75m ago, SSU only without introducers";
    9791002        }
    9801003        return null;
  • router/java/src/net/i2p/router/transport/udp/UDPTransport.java

    rffa4d65 r50d038a  
    15011501            if (valid >= PUBLIC_RELAY_COUNT) {
    15021502                // try to shift 'em around every 10 minutes or so
    1503                 if (sinceSelected > 10*60*1000) {
     1503                if (sinceSelected > 17*60*1000) {
    15041504                    if (_log.shouldLog(Log.WARN))
    15051505                        _log.warn("Our introducers are valid, but haven't changed in " + DataHelper.formatDuration(sinceSelected) + ", so lets rechoose");
Note: See TracChangeset for help on using the changeset viewer.