Changeset 1de840ce


Ignore:
Timestamp:
Sep 16, 2015 9:07:46 PM (5 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
d5a0d95
Parents:
0f6176b
Message:

Profiles: Bias slightly away from floodfills

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • history.txt

    r0f6176b r1de840ce  
     12015-09-16 zzz
     2 * Build:
     3   - Include geoip in update files for next release
     4   - Add created-by string to release torrents
     5 * i2psnark:
     6   - Store torrent added and completed times in config files, display on details page
     7   - Add metainfo creation command line support for created-by string
     8 * Profiles: Bias slightly away from floodfills
     9
    1102015-09-15 zzz
    211 * Console:
  • router/java/src/net/i2p/router/RouterVersion.java

    r0f6176b r1de840ce  
    1919    public final static String ID = "Monotone";
    2020    public final static String VERSION = CoreVersion.VERSION;
    21     public final static long BUILD = 2;
     21    public final static long BUILD = 3;
    2222
    2323    /** for example "-test" */
  • router/java/src/net/i2p/router/peermanager/CapacityCalculator.java

    r0f6176b r1de840ce  
    11package net.i2p.router.peermanager;
    22
    3 import net.i2p.I2PAppContext;
     3import net.i2p.data.router.RouterInfo;
     4import net.i2p.router.RouterContext;
     5import net.i2p.router.networkdb.kademlia.FloodfillNetworkDatabaseFacade;
    46import net.i2p.stat.Rate;
    57import net.i2p.stat.RateAverages;
     
    2628    private static final double BONUS_XOR = .25;
    2729    private static final double PENALTY_UNREACHABLE = 2;
     30    // we make this a bonus for non-ff, not a penalty for ff, so we
     31    // don't drive the ffs below the default
     32    private static final double BONUS_NON_FLOODFILL = 0.5;
    2833   
    2934    public static double calc(PeerProfile profile) {
     
    5560        // now take into account non-rejection tunnel rejections (which haven't
    5661        // incremented the rejection counter, since they were only temporary)
    57         I2PAppContext context = profile.getContext();
     62        RouterContext context = profile.getContext();
    5863        long now = context.clock().now();
    5964        if (profile.getTunnelHistory().getLastRejectedTransient() > now - 5*60*1000)
     
    8489        if (profile.wasUnreachable())
    8590            capacity -= PENALTY_UNREACHABLE;
     91
     92        // credit non-floodfill to reduce conn limit issues at floodfills
     93        // TODO only if we aren't floodfill ourselves?
     94        RouterInfo ri = context.netDb().lookupRouterInfoLocally(profile.getPeer());
     95        if (!FloodfillNetworkDatabaseFacade.isFloodfill(ri))
     96            capacity += BONUS_NON_FLOODFILL;
     97
    8698        // a tiny tweak to break ties and encourage closeness, -.25 to +.25
    87             capacity -= profile.getXORDistance() * (BONUS_XOR / 128);
     99        capacity -= profile.getXORDistance() * (BONUS_XOR / 128);
    88100
    89101        capacity += profile.getCapacityBonus();
Note: See TracChangeset for help on using the changeset viewer.