Router: Implement router.rejectStartupTime config (ticket #2285)

This commit is contained in:
zzz
2018-07-27 15:58:14 +00:00
parent fc817b0ec0
commit 2586db91c0
3 changed files with 11 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2018-07-27 zzz
* Console: Split netdb output into pages
* Router: Implement router.rejectStartupTime config (ticket #2285)
* Transport: Defer NTCP 1/2 classifiation until receiving 64 bytes
2018-07-21 zzz 2018-07-21 zzz
* Build: Add check for libtaglibs package in debian builds * Build: Add check for libtaglibs package in debian builds
* Console: Add netdb search by transport * Console: Add netdb search by transport

View File

@ -19,6 +19,7 @@ public class RouterThrottleImpl implements RouterThrottle {
protected final RouterContext _context; protected final RouterContext _context;
private final Log _log; private final Log _log;
private volatile String _tunnelStatus; private volatile String _tunnelStatus;
private final long _rejectStartupTime;
/** /**
* arbitrary hard limit - if it's taking this long to get * arbitrary hard limit - if it's taking this long to get
@ -33,6 +34,7 @@ public class RouterThrottleImpl implements RouterThrottle {
public static final int DEFAULT_MAX_TUNNELS = 10*1000; public static final int DEFAULT_MAX_TUNNELS = 10*1000;
private static final String PROP_MAX_PROCESSINGTIME = "router.defaultProcessingTimeThrottle"; private static final String PROP_MAX_PROCESSINGTIME = "router.defaultProcessingTimeThrottle";
private static final long DEFAULT_REJECT_STARTUP_TIME = 10*60*1000; private static final long DEFAULT_REJECT_STARTUP_TIME = 10*60*1000;
private static final long MIN_REJECT_STARTUP_TIME = 90*1000;
private static final String PROP_REJECT_STARTUP_TIME = "router.rejectStartupTime"; private static final String PROP_REJECT_STARTUP_TIME = "router.rejectStartupTime";
private static final int DEFAULT_MIN_THROTTLE_TUNNELS = SystemVersion.isAndroid() ? 100 : private static final int DEFAULT_MIN_THROTTLE_TUNNELS = SystemVersion.isAndroid() ? 100 :
SystemVersion.isARM() ? 500 : 1000; SystemVersion.isARM() ? 500 : 1000;
@ -53,7 +55,8 @@ public class RouterThrottleImpl implements RouterThrottle {
_context = context; _context = context;
_log = context.logManager().getLog(RouterThrottleImpl.class); _log = context.logManager().getLog(RouterThrottleImpl.class);
setTunnelStatus(); setTunnelStatus();
_context.simpleTimer2().addEvent(new ResetStatus(), 5*1000 + _context.getProperty(PROP_REJECT_STARTUP_TIME, DEFAULT_REJECT_STARTUP_TIME)); _rejectStartupTime = Math.max(MIN_REJECT_STARTUP_TIME, _context.getProperty(PROP_REJECT_STARTUP_TIME, DEFAULT_REJECT_STARTUP_TIME));
_context.simpleTimer2().addEvent(new ResetStatus(), 5*1000 + _rejectStartupTime);
_context.statManager().createRateStat("router.throttleNetworkCause", "How lagged the jobQueue was when an I2NP was throttled", "Throttle", new long[] { 60*1000, 10*60*1000, 60*60*1000, 24*60*60*1000 }); _context.statManager().createRateStat("router.throttleNetworkCause", "How lagged the jobQueue was when an I2NP was throttled", "Throttle", new long[] { 60*1000, 10*60*1000, 60*60*1000, 24*60*60*1000 });
//_context.statManager().createRateStat("router.throttleNetDbCause", "How lagged the jobQueue was when a networkDb request was throttled", "Throttle", new long[] { 60*1000, 10*60*1000, 60*60*1000, 24*60*60*1000 }); //_context.statManager().createRateStat("router.throttleNetDbCause", "How lagged the jobQueue was when a networkDb request was throttled", "Throttle", new long[] { 60*1000, 10*60*1000, 60*60*1000, 24*60*60*1000 });
_context.statManager().createRateStat("router.throttleTunnelCause", "How lagged the jobQueue was when a tunnel request was throttled", "Throttle", new long[] { 60*1000, 10*60*1000, 60*60*1000, 24*60*60*1000 }); _context.statManager().createRateStat("router.throttleTunnelCause", "How lagged the jobQueue was when a tunnel request was throttled", "Throttle", new long[] { 60*1000, 10*60*1000, 60*60*1000, 24*60*60*1000 });
@ -135,7 +138,7 @@ public class RouterThrottleImpl implements RouterThrottle {
} }
// Don't use CRIT because we don't want peers to think we're failing // Don't use CRIT because we don't want peers to think we're failing
if (_context.router().getUptime() < DEFAULT_REJECT_STARTUP_TIME) { if (_context.router().getUptime() < _rejectStartupTime) {
setTunnelStatus(_x("Rejecting tunnels: Starting up")); setTunnelStatus(_x("Rejecting tunnels: Starting up"));
return TunnelHistory.TUNNEL_REJECT_BANDWIDTH; return TunnelHistory.TUNNEL_REJECT_BANDWIDTH;
} }

View File

@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */ /** deprecated */
public final static String ID = "Monotone"; public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION; public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 17; public final static long BUILD = 18;
/** for example "-test" */ /** for example "-test" */
public final static String EXTRA = ""; public final static String EXTRA = "";