forked from I2P_Developers/i2p.i2p
* ProfileOrganizer: Add profileOrganizer.sameCountryBonus config
This commit is contained in:
17
history.txt
17
history.txt
@@ -1,3 +1,20 @@
|
||||
2012-02-04 zzz
|
||||
* Deprecate util classes used only by installer
|
||||
* ProfileOrganizer: Add profileOrganizer.sameCountryBonus config
|
||||
* WorkingDir: Reset dates of eepsite files while migrating
|
||||
to avoid exposing install time (thx Z6)
|
||||
* Wrapper files:
|
||||
- Move PID and status files to config dir in i2prouter
|
||||
- Don't set PID files in wrapper.config as Windows doesn't need them
|
||||
and the wrapper won't start if the dir doesn't exist
|
||||
- Move wrapper.log to config dir using override in i2prouter,
|
||||
Windows stays in system temp dir
|
||||
- Move wrapper.log to config dir for no wrapper
|
||||
- Move wrapper.log setup for no wrapper from RouterLaunch
|
||||
to WorkingDir
|
||||
- Redirect stderr too when no wrapper
|
||||
- Create config dir in i2prouter for Linux/Mac
|
||||
|
||||
2012-02-02 kytv
|
||||
* Ukrainian and Polish translation updates from Transifex
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ public class RouterVersion {
|
||||
/** deprecated */
|
||||
public final static String ID = "Monotone";
|
||||
public final static String VERSION = CoreVersion.VERSION;
|
||||
public final static long BUILD = 10;
|
||||
public final static long BUILD = 11;
|
||||
|
||||
/** for example "-test" */
|
||||
public final static String EXTRA = "";
|
||||
|
||||
@@ -10,6 +10,8 @@ import net.i2p.stat.RateStat;
|
||||
class CapacityCalculator {
|
||||
private static final I2PAppContext _context = I2PAppContext.getGlobalContext();
|
||||
|
||||
public static final String PROP_COUNTRY_BONUS = "profileOrganizer.sameCountryBonus";
|
||||
|
||||
/** used to adjust each period so that we keep trying to expand the peer's capacity */
|
||||
static final long GROWTH_FACTOR = 5;
|
||||
|
||||
@@ -65,8 +67,16 @@ class CapacityCalculator {
|
||||
if (profile.isEstablished())
|
||||
capacity += BONUS_ESTABLISHED;
|
||||
// boost same country
|
||||
if (profile.isSameCountry())
|
||||
capacity += BONUS_SAME_COUNTRY;
|
||||
if (profile.isSameCountry()) {
|
||||
double bonus = BONUS_SAME_COUNTRY;
|
||||
String b = _context.getProperty(PROP_COUNTRY_BONUS);
|
||||
if (b != null) {
|
||||
try {
|
||||
bonus = Double.parseDouble(b);
|
||||
} catch (NumberFormatException nfe) {}
|
||||
}
|
||||
capacity += bonus;
|
||||
}
|
||||
// penalize unreachable peers
|
||||
if (profile.wasUnreachable())
|
||||
capacity -= PENALTY_UNREACHABLE;
|
||||
|
||||
@@ -134,7 +134,8 @@ public class PeerProfile {
|
||||
boolean isSameCountry() {
|
||||
String us = _context.commSystem().getOurCountry();
|
||||
return us != null &&
|
||||
_bigCountries.contains(us) &&
|
||||
(_bigCountries.contains(us) ||
|
||||
_context.getProperty(CapacityCalculator.PROP_COUNTRY_BONUS) != null) &&
|
||||
us.equals(_context.commSystem().getCountry(_peer));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user