merge of '1fd43bf251a91d33bb1ea9b06f2b35a40be3b9c9'

and '766a92b57cdf82d3b1d1e3a71ef2a3109e883add'
This commit is contained in:
dg2-new
2014-01-04 17:41:15 +00:00
7 changed files with 51 additions and 15 deletions

View File

@@ -13,6 +13,7 @@ import net.i2p.I2PAppContext;
import net.i2p.client.streaming.I2PSocketEepGet;
import net.i2p.client.streaming.I2PSocketManager;
import net.i2p.crypto.SHA1;
import net.i2p.data.DataHelper;
import net.i2p.util.EepGet;
import net.i2p.util.I2PAppThread;
import net.i2p.util.Log;
@@ -96,7 +97,7 @@ public class FetchAndAdd extends Snark implements EepGet.StatusListener, Runnabl
add(file);
} else {
_mgr.addMessage(_("Torrent was not retrieved from {0}", urlify(_url)) +
((_failCause != null) ? (": " + _failCause) : ""));
((_failCause != null) ? (": " + DataHelper.stripHTML(_failCause)) : ""));
}
if (file != null)
file.delete();

View File

@@ -71,8 +71,8 @@ public class ConfigRestartBean {
buf.append(_("Shutdown in {0}", DataHelper.formatDuration2(timeRemaining), ctx));
int tuns = ctx.tunnelManager().getParticipatingCount();
if (tuns > 0) {
buf.append("<br>").append(ngettext("Please wait for routing commitment on {0} tunnel to expire",
"Please wait for routing commitments on {0} tunnels to expire",
buf.append("<br>").append(ngettext("Please wait for routing commitment to expire for {0} tunnel",
"Please wait for routing commitments to expire for {0} tunnels",
tuns, ctx));
}
buf.append("</h4><hr>");
@@ -82,8 +82,8 @@ public class ConfigRestartBean {
buf.append(_("Restart in {0}", DataHelper.formatDuration2(timeRemaining), ctx));
int tuns = ctx.tunnelManager().getParticipatingCount();
if (tuns > 0) {
buf.append("<br>").append(ngettext("Please wait for routing commitment on {0} tunnel to expire",
"Please wait for routing commitments on {0} tunnels to expire",
buf.append("<br>").append(ngettext("Please wait for routing commitment to expire for {0} tunnel",
"Please wait for routing commitments to expire for {0} tunnels",
tuns, ctx));
}
buf.append("</h4><hr>");

View File

@@ -305,8 +305,9 @@ public class I2PSocketManagerFull implements I2PSocketManager {
I2PSocket sock = connect(peer, options);
return new StandardSocket(sock);
} catch (I2PException i2pe) {
// fixme in 1.6 change to cause
throw new IOException(i2pe.toString());
IOException ioe = new IOException("connect fail");
ioe.initCause(i2pe);
throw ioe;
}
}

View File

@@ -44,8 +44,9 @@ class StandardServerSocket extends ServerSocket {
throw new IOException("No socket");
return new StandardSocket(sock);
} catch (I2PException i2pe) {
// fixme in 1.6 change to cause
throw new IOException(i2pe.toString());
IOException ioe = new IOException("accept fail");
ioe.initCause(i2pe);
throw ioe;
}
}

View File

@@ -1,3 +1,8 @@
2014-01-04 zzz
* Peermanager: Disable small same-country bonus
* Tunnels: Change client default to 3 hops in router;
change expl. default to 2+0 IB and 2 + 0-1 OB
2014-01-04 dg
* Streaming: Move streaming to new package (ticket #1135)

View File

@@ -5,6 +5,7 @@ import java.util.Map;
import java.util.Properties;
import net.i2p.data.Hash;
import net.i2p.util.NativeBigInteger;
import net.i2p.util.RandomSource;
import net.i2p.util.SystemVersion;
@@ -56,8 +57,22 @@ public class TunnelPoolSettings {
// public static final int DEFAULT_REBUILD_PERIOD = 60*1000;
public static final int DEFAULT_DURATION = 10*60*1000;
//public static final int DEFAULT_LENGTH = SystemVersion.isAndroid() ? 2 : 3;
public static final int DEFAULT_LENGTH = 2;
public static final int DEFAULT_LENGTH_VARIANCE = 0;
private static final boolean isSlow = SystemVersion.isGNU() ||
SystemVersion.isARM() ||
SystemVersion.isApache() ||
!NativeBigInteger.isNative();
/** client only */
private static final int DEFAULT_IB_LENGTH = 3;
private static final int DEFAULT_OB_LENGTH = 3;
private static final int DEFAULT_LENGTH_VARIANCE = 0;
/** expl only */
private static final int DEFAULT_IB_EXPL_LENGTH = 2;
private static final int DEFAULT_OB_EXPL_LENGTH = 2;
private static final int DEFAULT_IB_EXPL_LENGTH_VARIANCE = 0;
private static final int DEFAULT_OB_EXPL_LENGTH_VARIANCE = isSlow ? 0 : 1;
public static final boolean DEFAULT_ALLOW_ZERO_HOP = true;
public static final int DEFAULT_IP_RESTRICTION = 2; // class B (/16)
private static final int MIN_PRIORITY = -25;
@@ -72,8 +87,13 @@ public class TunnelPoolSettings {
_backupQuantity = DEFAULT_BACKUP_QUANTITY;
// _rebuildPeriod = DEFAULT_REBUILD_PERIOD;
//_duration = DEFAULT_DURATION;
_length = DEFAULT_LENGTH;
_lengthVariance = DEFAULT_LENGTH_VARIANCE;
if (isInbound) {
_length = isExploratory ? DEFAULT_IB_EXPL_LENGTH : DEFAULT_IB_LENGTH;
_lengthVariance = isExploratory ? DEFAULT_IB_EXPL_LENGTH_VARIANCE : DEFAULT_LENGTH_VARIANCE;
} else {
_length = isExploratory ? DEFAULT_OB_EXPL_LENGTH : DEFAULT_OB_LENGTH;
_lengthVariance = isExploratory ? DEFAULT_OB_EXPL_LENGTH_VARIANCE : DEFAULT_LENGTH_VARIANCE;
}
_lengthOverride = -1;
if (isExploratory)
_allowZeroHop = true;
@@ -212,9 +232,15 @@ public class TunnelPoolSettings {
//else if (name.equalsIgnoreCase(prefix + PROP_DURATION))
// _duration = getInt(value, DEFAULT_DURATION);
else if (name.equalsIgnoreCase(prefix + PROP_LENGTH))
_length = getInt(value, DEFAULT_LENGTH);
_length = getInt(value, _isInbound ?
(_isExploratory ? DEFAULT_IB_EXPL_LENGTH : DEFAULT_IB_LENGTH) :
(_isExploratory ? DEFAULT_OB_EXPL_LENGTH : DEFAULT_OB_LENGTH));
else if (name.equalsIgnoreCase(prefix + PROP_LENGTH_VARIANCE))
_lengthVariance = getInt(value, DEFAULT_LENGTH_VARIANCE);
_lengthVariance = getInt(value, _isExploratory ?
(_isInbound ?
DEFAULT_IB_EXPL_LENGTH_VARIANCE :
DEFAULT_OB_EXPL_LENGTH_VARIANCE) :
DEFAULT_LENGTH_VARIANCE);
else if (name.equalsIgnoreCase(prefix + PROP_QUANTITY))
_quantity = getInt(value, DEFAULT_QUANTITY);
// else if (name.equalsIgnoreCase(prefix + PROP_REBUILD_PERIOD))

View File

@@ -67,6 +67,7 @@ class CapacityCalculator {
// boost connected peers
if (profile.isEstablished())
capacity += BONUS_ESTABLISHED;
/****
// boost same country
if (profile.isSameCountry()) {
double bonus = BONUS_SAME_COUNTRY;
@@ -78,6 +79,7 @@ class CapacityCalculator {
}
capacity += bonus;
}
****/
// penalize unreachable peers
if (profile.wasUnreachable())
capacity -= PENALTY_UNREACHABLE;