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

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

Tunnels: Limit requested client tunnels during congestion

This will probably also reduce builds at startup.
Limits may require tweaks after further testing.
parent 32ffd056
No related branches found
No related tags found
No related merge requests found
2022-12-29 zzz
* Tunnels: Limit requested client tunnels during congestion
2022-12-26 zzz 2022-12-26 zzz
* Console: Sort tunnels by name on /tunnels, /configtunnels, /i2ptunnel * Console: Sort tunnels by name on /tunnels, /configtunnels, /i2ptunnel
* Router: Don't blocklist our own IP * Router: Don't blocklist our own IP
......
...@@ -18,10 +18,10 @@ public class RouterVersion { ...@@ -18,10 +18,10 @@ public class RouterVersion {
/** deprecated */ /** deprecated */
public final static String ID = "Git"; public final static String ID = "Git";
public final static String VERSION = CoreVersion.VERSION; public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 12; public final static long BUILD = 13;
/** for example "-test" */ /** for example "-test" */
public final static String EXTRA = ""; public final static String EXTRA = "-rc";
public final static String FULL_VERSION = VERSION + "-" + BUILD + EXTRA; public final static String FULL_VERSION = VERSION + "-" + BUILD + EXTRA;
public static void main(String args[]) { public static void main(String args[]) {
System.out.println("I2P Router version: " + FULL_VERSION); System.out.println("I2P Router version: " + FULL_VERSION);
......
...@@ -332,8 +332,24 @@ public class TunnelPool { ...@@ -332,8 +332,24 @@ public class TunnelPool {
if (_settings.getLength() == 0 && _settings.getLengthVariance() == 0) if (_settings.getLength() == 0 && _settings.getLengthVariance() == 0)
return 1; return 1;
int rv = _settings.getTotalQuantity(); int rv = _settings.getTotalQuantity();
if (!_settings.isExploratory()) if (!_settings.isExploratory()) {
if (rv <= 1)
return rv;
// throttle client tunnel builds in times of congestion
int fails = _consecutiveBuildTimeouts.get();
if (fails > 4) {
if (fails > 8) {
rv = 1;
if (_log.shouldWarn())
_log.warn("Limit to 1 tunnel after " + fails + " consec. build timeouts on " + this);
} else if (rv > 2) {
rv--;
if (_log.shouldWarn())
_log.warn("Limit to " + rv + " tunnels after " + fails + " consec. build timeouts on " + this);
}
}
return rv; return rv;
}
// TODO high-bw non-ff also // TODO high-bw non-ff also
if (_context.netDb().floodfillEnabled() && if (_context.netDb().floodfillEnabled() &&
_context.router().getUptime() > 5*60*1000) { _context.router().getUptime() > 5*60*1000) {
......
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