Changeset 719ba3f


Ignore:
Timestamp:
Aug 4, 2008 7:31:11 PM (13 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
49af13a
Parents:
9652db9
Message:
  • Floodfill Peer Selector:
    • Avoid peers whose netdb is old, or have a recent failed store, or are forever-shitlisted
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • history.txt

    r9652db9 r719ba3f  
     12008-08-04 zzz
     2    * Floodfill Peer Selector:
     3      - Avoid peers whose netdb is old, or have a recent failed store,
     4        or are forever-shitlisted
     5
    162008-07-30 zzz
    27    * Blocklists:
  • router/java/src/net/i2p/router/RouterVersion.java

    r9652db9 r719ba3f  
    1818    public final static String ID = "$Revision: 1.548 $ $Date: 2008-06-07 23:00:00 $";
    1919    public final static String VERSION = "0.6.2";
    20     public final static long BUILD = 10;
     20    public final static long BUILD = 11;
    2121    public static void main(String args[]) {
    2222        System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
  • router/java/src/net/i2p/router/networkdb/kademlia/FloodfillPeerSelector.java

    r9652db9 r719ba3f  
    2020import net.i2p.data.RouterInfo;
    2121import net.i2p.router.RouterContext;
     22import net.i2p.router.peermanager.PeerProfile;
    2223import net.i2p.util.Log;
    2324
     
    7980            //if (_context.shitlist().isShitlisted(entry))
    8081            //    return;
     82            // ... unless they are really bad
     83            if (_context.shitlist().isShitlistedForever(entry))
     84                return;
    8185            RouterInfo info = _context.netDb().lookupRouterInfoLocally(entry);
    8286            //if (info == null)
     
    99103            Collections.shuffle(_floodfillMatches, _context.random());
    100104            List rv = new ArrayList(howMany);
    101             for (int i = 0; i < howMany && i < _floodfillMatches.size(); i++) {
    102                 rv.add(_floodfillMatches.get(i));
     105            List badff = new ArrayList(howMany);
     106            int found = 0;
     107            long now = _context.clock().now();
     108            // Only add in "good" floodfills here...
     109            // Let's say published in last 3h and no failed sends in last 30m
     110            // (Forever shitlisted ones are excluded in add() above)
     111            for (int i = 0; found < howMany && i < _floodfillMatches.size(); i++) {
     112                Hash entry = (Hash) _floodfillMatches.get(i);
     113                RouterInfo info = _context.netDb().lookupRouterInfoLocally(entry);
     114                if (info != null && now - info.getPublished() > 3*60*60*1000) {
     115                    badff.add(entry);
     116                    if (_log.shouldLog(Log.DEBUG))
     117                        _log.debug("Skipping, published a while ago: " + entry);
     118                } else {
     119                    PeerProfile prof = _context.profileOrganizer().getProfile(entry);
     120                    if (prof != null && now - prof.getLastSendFailed() < 30*60*1000) {
     121                        badff.add(entry);
     122                        if (_log.shouldLog(Log.DEBUG))
     123                            _log.debug("Skipping, recent failed send: " + entry);
     124                    } else {
     125                        rv.add(entry);
     126                        found++;
     127                    }
     128                }
     129            }
     130            // Put the "bad" floodfills at the end of the floodfills but before the kademlias
     131            for (int i = 0; found < howMany && i < badff.size(); i++) {
     132                rv.add(badff.get(i));
     133                found++;
    103134            }
    104135            for (int i = rv.size(); i < howMany; i++) {
Note: See TracChangeset for help on using the changeset viewer.