2006-02-16 jrandom

* Add a new toggle to the web config to enable/disable the load testing
This commit is contained in:
jrandom
2006-02-16 10:33:29 +00:00
committed by zzz
parent 2e9e0c64d4
commit 9e00dbaafd
6 changed files with 47 additions and 3 deletions

View File

@ -18,6 +18,7 @@ import java.util.Set;
import net.i2p.time.Timestamper;
import net.i2p.router.transport.udp.UDPTransport;
import net.i2p.router.Router;
import net.i2p.router.LoadTestManager;
import net.i2p.data.RouterInfo;
import net.i2p.router.web.ConfigServiceHandler.UpdateWrapperManagerTask;
import net.i2p.router.web.ConfigServiceHandler.UpdateWrapperManagerAndRekeyTask;
@ -46,6 +47,7 @@ public class ConfigNetHandler extends FormHandler {
private String _outboundBurstRate;
private String _outboundBurst;
private String _reseedFrom;
private boolean _enableLoadTesting;
private String _sharePct;
private boolean _ratesOnly;
@ -72,6 +74,7 @@ public class ConfigNetHandler extends FormHandler {
public void setHiddenMode(String moo) { _hiddenMode = true; }
public void setDynamicKeys(String moo) { _dynamicKeys = true; }
public void setUpdateratesonly(String moo) { _ratesOnly = true; }
public void setEnableloadtesting(String moo) { _enableLoadTesting = true; }
public void setHostname(String hostname) {
_hostname = (hostname != null ? hostname.trim() : null);
@ -313,6 +316,8 @@ public class ConfigNetHandler extends FormHandler {
} else {
_context.router().setConfigSetting(Timestamper.PROP_DISABLED, "true");
}
LoadTestManager.setEnableLoadTesting(_context, _enableLoadTesting);
}
boolean saved = _context.router().saveConfig();

View File

@ -4,6 +4,7 @@ import net.i2p.time.Timestamper;
import net.i2p.router.RouterContext;
import net.i2p.router.CommSystemFacade;
import net.i2p.data.RouterAddress;
import net.i2p.router.LoadTestManager;
import net.i2p.router.transport.udp.UDPAddress;
import net.i2p.router.transport.udp.UDPTransport;
import net.i2p.router.Router;
@ -195,6 +196,13 @@ public class ConfigNetHelper {
return buf.toString();
}
public String getEnableLoadTesting() {
if (LoadTestManager.isEnabled(_context))
return " checked ";
else
return "";
}
public String getSharePercentageBox() {
String pctStr = _context.getProperty(PROP_SHARE_PERCENTAGE);
int pct = DEFAULT_SHARE_PERCENTAGE;