I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit ffda7f63 authored by zzz's avatar zzz
Browse files

* Tunnels:

   - Make expl. default 3 hops  (ticket #966)
   - Allow expl. fallback up to -2 hops
parent 8ebacf4c
No related branches found
No related tags found
No related merge requests found
...@@ -53,7 +53,7 @@ public class TunnelPoolSettings { ...@@ -53,7 +53,7 @@ public class TunnelPoolSettings {
public static final int DEFAULT_BACKUP_QUANTITY = 0; public static final int DEFAULT_BACKUP_QUANTITY = 0;
// public static final int DEFAULT_REBUILD_PERIOD = 60*1000; // public static final int DEFAULT_REBUILD_PERIOD = 60*1000;
public static final int DEFAULT_DURATION = 10*60*1000; public static final int DEFAULT_DURATION = 10*60*1000;
public static final int DEFAULT_LENGTH = 2; public static final int DEFAULT_LENGTH = 3;
public static final int DEFAULT_LENGTH_VARIANCE = 0; public static final int DEFAULT_LENGTH_VARIANCE = 0;
public static final boolean DEFAULT_ALLOW_ZERO_HOP = true; public static final boolean DEFAULT_ALLOW_ZERO_HOP = true;
public static final int DEFAULT_IP_RESTRICTION = 2; // class B (/16) public static final int DEFAULT_IP_RESTRICTION = 2; // class B (/16)
......
...@@ -50,7 +50,8 @@ public class TunnelPool { ...@@ -50,7 +50,8 @@ public class TunnelPool {
/** if less than one success in this many, reduce quantity (exploratory only) */ /** if less than one success in this many, reduce quantity (exploratory only) */
private static final int BUILD_TRIES_QUANTITY_OVERRIDE = 12; private static final int BUILD_TRIES_QUANTITY_OVERRIDE = 12;
/** if less than one success in this many, reduce length (exploratory only) */ /** if less than one success in this many, reduce length (exploratory only) */
private static final int BUILD_TRIES_LENGTH_OVERRIDE = 18; private static final int BUILD_TRIES_LENGTH_OVERRIDE_1 = 10;
private static final int BUILD_TRIES_LENGTH_OVERRIDE_2 = 18;
TunnelPool(RouterContext ctx, TunnelPoolManager mgr, TunnelPoolSettings settings, TunnelPeerSelector sel) { TunnelPool(RouterContext ctx, TunnelPoolManager mgr, TunnelPoolSettings settings, TunnelPeerSelector sel) {
_context = ctx; _context = ctx;
...@@ -374,10 +375,15 @@ public class TunnelPool { ...@@ -374,10 +375,15 @@ public class TunnelPool {
long rc = rr.computeAverages(ra, false).getTotalEventCount(); long rc = rr.computeAverages(ra, false).getTotalEventCount();
long sc = sr.computeAverages(ra, false).getTotalEventCount(); long sc = sr.computeAverages(ra, false).getTotalEventCount();
long tot = ec + rc + sc; long tot = ec + rc + sc;
if (tot >= BUILD_TRIES_LENGTH_OVERRIDE) { if (tot >= BUILD_TRIES_LENGTH_OVERRIDE_1) {
if (1000 * sc / tot <= 1000 / BUILD_TRIES_LENGTH_OVERRIDE) long succ = 1000 * sc / tot;
_settings.setLengthOverride(len - 1); if (succ <= 1000 / BUILD_TRIES_LENGTH_OVERRIDE_1) {
if (len > 2 && succ <= 1000 / BUILD_TRIES_LENGTH_OVERRIDE_2)
_settings.setLengthOverride(len - 2);
else
_settings.setLengthOverride(len - 1);
return; return;
}
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment