Changeset 1793b057


Ignore:
Timestamp:
Nov 9, 2008 4:02:44 PM (12 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
9f57be5
Parents:
f95c324
Message:
  • NetDb?: Don't drop routerInfos if we have connectivity issues or other problems
Location:
router/java/src/net/i2p/router
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/networkdb/kademlia/FloodfillNetworkDatabaseFacade.java

    rf95c324 r1793b057  
    2121import net.i2p.router.OutNetMessage;
    2222import net.i2p.router.ReplyJob;
     23import net.i2p.router.Router;
    2324import net.i2p.router.RouterContext;
    2425import net.i2p.router.TunnelInfo;
     
    257258    }
    258259   
     260    /** NTCP cons drop quickly but SSU takes a while, so it's prudent to keep this
     261     *  a little higher than 1 or 2. */
     262    protected final static int MIN_ACTIVE_PEERS = 5;
     263
     264    /**
     265      * Search for a newer router info, drop it from the db if the search fails,
     266      * unless just started up or have bigger problems.
     267      */
    259268    protected void lookupBeforeDropping(Hash peer, RouterInfo info) {
     269        // following are some special situations, we don't want to
     270        // drop the peer in these cases
     271        // yikes don't do this - stack overflow //  getFloodfillPeers().size() == 0 ||
     272        if (info.getNetworkId() == Router.NETWORK_ID &&
     273            (getKnownRouters() < MIN_REMAINING_ROUTERS ||
     274             _context.router().getUptime() < DONT_FAIL_PERIOD ||
     275             _context.commSystem().countActivePeers() <= MIN_ACTIVE_PEERS)) {
     276            if (_log.shouldLog(Log.WARN))
     277                _log.warn("Not failing " + peer.toBase64() + " as we are just starting up or have problems");
     278            return;
     279        }
     280
    260281        if (_context.jobQueue().getMaxLag() > 500) {
    261282            // don't try to overload ourselves (e.g. failing 3000 router refs at
  • router/java/src/net/i2p/router/networkdb/kademlia/KademliaNetworkDatabaseFacade.java

    rf95c324 r1793b057  
    100100     * previous references
    101101     */
    102     private final static long DONT_FAIL_PERIOD = 10*60*1000;
     102    protected final static long DONT_FAIL_PERIOD = 10*60*1000;
    103103   
    104104    /** don't probe or broadcast data, just respond and search when explicitly needed */
     
    112112    public final static String DEFAULT_DB_DIR = "netDb";
    113113   
    114     /** if we have less than 5 routers left, don't drop any more, even if they're failing or doing bad shit */
    115     private final static int MIN_REMAINING_ROUTERS = 5;
     114    /** if we have less than this many routers left, don't drop any more,
     115     *  even if they're failing or doing bad shit.
     116     */
     117    protected final static int MIN_REMAINING_ROUTERS = 25;
    116118   
    117119    /**
     
    757759       
    758760        if (isRouterInfo) {
    759             if (((RouterInfo)o).getNetworkId() != Router.NETWORK_ID) {
    760                 // definitely drop them
    761             } else {
    762                 int remaining = _kb.size();
    763                 if (remaining < MIN_REMAINING_ROUTERS) {
    764                     if (_log.shouldLog(Log.WARN))
    765                         _log.warn("Not removing " + dbEntry + " because we have so few routers left ("
    766                                   + remaining + ") - perhaps a reseed is necessary?");
    767                     return;
    768                 }
    769                 if (System.currentTimeMillis() < _started + DONT_FAIL_PERIOD) {
    770                     if (_log.shouldLog(Log.WARN))
    771                         _log.warn("Not failing the key " + dbEntry.toBase64()
    772                                   + " since we've just started up and don't want to drop /everyone/");
    773                     return;
    774                 }
    775             }
    776            
    777761            lookupBeforeDropping(dbEntry, (RouterInfo)o);
    778762            return;
     
    807791    }
    808792   
     793    /** don't use directly - see F.N.D.F. override */
    809794    protected void lookupBeforeDropping(Hash peer, RouterInfo info) {
    810795        //bah, humbug.
  • router/java/src/net/i2p/router/transport/TransportManager.java

    rf95c324 r1793b057  
    312312        }
    313313        if (unreachableTransports >= _transports.size()) {
    314             _context.statManager().addRateData("transport.shitlistOnUnreachable", msg.getLifetime(), msg.getLifetime());
    315             _context.shitlist().shitlistRouter(peer, "Unreachable on any transport");
     314            // Don't shitlist if we aren't talking to anybody, as we may have a network connection issue
     315            if (unreachableTransports >= _transports.size() && countActivePeers() > 0) {
     316                _context.statManager().addRateData("transport.shitlistOnUnreachable", msg.getLifetime(), msg.getLifetime());
     317                _context.shitlist().shitlistRouter(peer, "Unreachable on any transport");
     318            }
    316319        } else if (rv == null) {
    317320            _context.statManager().addRateData("transport.noBidsYetNotAllUnreachable", unreachableTransports, msg.getLifetime());
Note: See TracChangeset for help on using the changeset viewer.