forked from I2P_Developers/i2p.i2p
2006-02-16 jrandom
* Add a new toggle to the web config to enable/disable the load testing
This commit is contained in:
@ -18,6 +18,7 @@ import java.util.Set;
|
|||||||
import net.i2p.time.Timestamper;
|
import net.i2p.time.Timestamper;
|
||||||
import net.i2p.router.transport.udp.UDPTransport;
|
import net.i2p.router.transport.udp.UDPTransport;
|
||||||
import net.i2p.router.Router;
|
import net.i2p.router.Router;
|
||||||
|
import net.i2p.router.LoadTestManager;
|
||||||
import net.i2p.data.RouterInfo;
|
import net.i2p.data.RouterInfo;
|
||||||
import net.i2p.router.web.ConfigServiceHandler.UpdateWrapperManagerTask;
|
import net.i2p.router.web.ConfigServiceHandler.UpdateWrapperManagerTask;
|
||||||
import net.i2p.router.web.ConfigServiceHandler.UpdateWrapperManagerAndRekeyTask;
|
import net.i2p.router.web.ConfigServiceHandler.UpdateWrapperManagerAndRekeyTask;
|
||||||
@ -46,6 +47,7 @@ public class ConfigNetHandler extends FormHandler {
|
|||||||
private String _outboundBurstRate;
|
private String _outboundBurstRate;
|
||||||
private String _outboundBurst;
|
private String _outboundBurst;
|
||||||
private String _reseedFrom;
|
private String _reseedFrom;
|
||||||
|
private boolean _enableLoadTesting;
|
||||||
private String _sharePct;
|
private String _sharePct;
|
||||||
private boolean _ratesOnly;
|
private boolean _ratesOnly;
|
||||||
|
|
||||||
@ -72,6 +74,7 @@ public class ConfigNetHandler extends FormHandler {
|
|||||||
public void setHiddenMode(String moo) { _hiddenMode = true; }
|
public void setHiddenMode(String moo) { _hiddenMode = true; }
|
||||||
public void setDynamicKeys(String moo) { _dynamicKeys = true; }
|
public void setDynamicKeys(String moo) { _dynamicKeys = true; }
|
||||||
public void setUpdateratesonly(String moo) { _ratesOnly = true; }
|
public void setUpdateratesonly(String moo) { _ratesOnly = true; }
|
||||||
|
public void setEnableloadtesting(String moo) { _enableLoadTesting = true; }
|
||||||
|
|
||||||
public void setHostname(String hostname) {
|
public void setHostname(String hostname) {
|
||||||
_hostname = (hostname != null ? hostname.trim() : null);
|
_hostname = (hostname != null ? hostname.trim() : null);
|
||||||
@ -313,6 +316,8 @@ public class ConfigNetHandler extends FormHandler {
|
|||||||
} else {
|
} else {
|
||||||
_context.router().setConfigSetting(Timestamper.PROP_DISABLED, "true");
|
_context.router().setConfigSetting(Timestamper.PROP_DISABLED, "true");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LoadTestManager.setEnableLoadTesting(_context, _enableLoadTesting);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean saved = _context.router().saveConfig();
|
boolean saved = _context.router().saveConfig();
|
||||||
|
@ -4,6 +4,7 @@ import net.i2p.time.Timestamper;
|
|||||||
import net.i2p.router.RouterContext;
|
import net.i2p.router.RouterContext;
|
||||||
import net.i2p.router.CommSystemFacade;
|
import net.i2p.router.CommSystemFacade;
|
||||||
import net.i2p.data.RouterAddress;
|
import net.i2p.data.RouterAddress;
|
||||||
|
import net.i2p.router.LoadTestManager;
|
||||||
import net.i2p.router.transport.udp.UDPAddress;
|
import net.i2p.router.transport.udp.UDPAddress;
|
||||||
import net.i2p.router.transport.udp.UDPTransport;
|
import net.i2p.router.transport.udp.UDPTransport;
|
||||||
import net.i2p.router.Router;
|
import net.i2p.router.Router;
|
||||||
@ -195,6 +196,13 @@ public class ConfigNetHelper {
|
|||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getEnableLoadTesting() {
|
||||||
|
if (LoadTestManager.isEnabled(_context))
|
||||||
|
return " checked ";
|
||||||
|
else
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
public String getSharePercentageBox() {
|
public String getSharePercentageBox() {
|
||||||
String pctStr = _context.getProperty(PROP_SHARE_PERCENTAGE);
|
String pctStr = _context.getProperty(PROP_SHARE_PERCENTAGE);
|
||||||
int pct = DEFAULT_SHARE_PERCENTAGE;
|
int pct = DEFAULT_SHARE_PERCENTAGE;
|
||||||
|
@ -58,6 +58,14 @@
|
|||||||
<jsp:getProperty name="nethelper" property="sharePercentageBox" /><br />
|
<jsp:getProperty name="nethelper" property="sharePercentageBox" /><br />
|
||||||
Sharing a higher percentage will improve your anonymity and help the network
|
Sharing a higher percentage will improve your anonymity and help the network
|
||||||
<hr />
|
<hr />
|
||||||
|
<b>Enable load testing: </b>
|
||||||
|
<input type="checkbox" name="enableloadtesting" value="true" <jsp:getProperty name="nethelper" property="enableLoadTesting" /> />
|
||||||
|
<p>If enabled, your router will periodically anonymously probe some of your peers
|
||||||
|
to see what sort of throughput they can handle. This improves your router's ability
|
||||||
|
to pick faster peers, but can cost substantial bandwidth. Relevent data from the
|
||||||
|
load testing is fed into the profiles as well as the
|
||||||
|
<a href="oldstats.jsp#test.rtt">test.rtt</a> and related stats.</p>
|
||||||
|
<hr />
|
||||||
<b>Dynamic Router Keys: </b>
|
<b>Dynamic Router Keys: </b>
|
||||||
<input type="checkbox" name="dynamicKeys" value="true" <jsp:getProperty name="nethelper" property="dynamicKeysChecked" /> /><br />
|
<input type="checkbox" name="dynamicKeys" value="true" <jsp:getProperty name="nethelper" property="dynamicKeysChecked" /> /><br />
|
||||||
<p>
|
<p>
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
$Id: history.txt,v 1.399 2006/02/16 03:24:23 jrandom Exp $
|
$Id: history.txt,v 1.400 2006/02/16 04:45:23 jrandom Exp $
|
||||||
|
|
||||||
|
2006-02-16 jrandom
|
||||||
|
* Add a new toggle to the web config to enable/disable the load testing
|
||||||
|
|
||||||
2006-02-16 jrandom
|
2006-02-16 jrandom
|
||||||
* Dropped much of the abandonware from the apps/ directory
|
* Dropped much of the abandonware from the apps/ directory
|
||||||
|
@ -2,6 +2,7 @@ package net.i2p.router;
|
|||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import net.i2p.I2PAppContext;
|
||||||
import net.i2p.util.*;
|
import net.i2p.util.*;
|
||||||
import net.i2p.data.*;
|
import net.i2p.data.*;
|
||||||
import net.i2p.data.i2np.*;
|
import net.i2p.data.i2np.*;
|
||||||
@ -75,7 +76,26 @@ public class LoadTestManager {
|
|||||||
/** 4 messages per peer at a time */
|
/** 4 messages per peer at a time */
|
||||||
private static final int CONCURRENT_MESSAGES = 1;//4;
|
private static final int CONCURRENT_MESSAGES = 1;//4;
|
||||||
|
|
||||||
|
private static final boolean DEFAULT_ENABLE = true;
|
||||||
|
|
||||||
|
public static boolean isEnabled(I2PAppContext ctx) {
|
||||||
|
String enable = ctx.getProperty("router.enableLoadTesting");
|
||||||
|
if ( (DEFAULT_ENABLE) && (enable != null) && (!Boolean.valueOf(enable).booleanValue()) )
|
||||||
|
return false;
|
||||||
|
else if ( (!DEFAULT_ENABLE) && ((enable == null) || (!Boolean.valueOf(enable).booleanValue()) ) )
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public static void setEnableLoadTesting(RouterContext ctx, boolean enable) {
|
||||||
|
if (enable)
|
||||||
|
ctx.router().setConfigSetting("router.enableLoadTesting", "true");
|
||||||
|
else
|
||||||
|
ctx.router().setConfigSetting("router.enableLoadTesting", "false");
|
||||||
|
}
|
||||||
|
|
||||||
private int getConcurrency() {
|
private int getConcurrency() {
|
||||||
|
if (!isEnabled(_context)) return 0;
|
||||||
|
|
||||||
int rv = CONCURRENT_PEERS;
|
int rv = CONCURRENT_PEERS;
|
||||||
try {
|
try {
|
||||||
rv = Integer.parseInt(_context.getProperty("router.loadTestConcurrency", CONCURRENT_PEERS+""));
|
rv = Integer.parseInt(_context.getProperty("router.loadTestConcurrency", CONCURRENT_PEERS+""));
|
||||||
|
@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class RouterVersion {
|
public class RouterVersion {
|
||||||
public final static String ID = "$Revision: 1.342 $ $Date: 2006/02/15 08:36:32 $";
|
public final static String ID = "$Revision: 1.343 $ $Date: 2006/02/16 03:24:20 $";
|
||||||
public final static String VERSION = "0.6.1.9";
|
public final static String VERSION = "0.6.1.9";
|
||||||
public final static long BUILD = 27;
|
public final static long BUILD = 28;
|
||||||
public static void main(String args[]) {
|
public static void main(String args[]) {
|
||||||
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
|
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
|
||||||
System.out.println("Router ID: " + RouterVersion.ID);
|
System.out.println("Router ID: " + RouterVersion.ID);
|
||||||
|
Reference in New Issue
Block a user