propagate from branch 'i2p.i2p.zzz.test' (head eb755dae363d71808cb93ae1c6c976c1ec5df5d2)

to branch 'i2p.i2p' (head 25097fabfedcbe372d42dcddaf89b5279e9285e4)
This commit is contained in:
zzz
2009-05-01 12:56:10 +00:00
15 changed files with 73 additions and 19 deletions

View File

@ -49,7 +49,7 @@ public class PeerHelper {
return "ERROR: The UDP port is already in use. Set i2np.udp.internalPort=xxxx to a different value in the advanced config and restart";
case CommSystemFacade.STATUS_UNKNOWN: // fallthrough
default:
ra = context.router().getRouterInfo().getTargetAddress("UDP");
ra = context.router().getRouterInfo().getTargetAddress("SSU");
if (ra == null && context.router().getUptime() > 5*60*1000) {
if (context.getProperty(PROP_I2NP_NTCP_HOSTNAME) == null ||
context.getProperty(PROP_I2NP_NTCP_PORT) == null)

View File

@ -39,7 +39,7 @@ public class I2PTunnelClient extends I2PTunnelClientBase {
return;
}
StringTokenizer tok = new StringTokenizer(destinations, ",");
StringTokenizer tok = new StringTokenizer(destinations, ", ");
dests = new ArrayList(1);
while (tok.hasMoreTokens()) {
String destination = tok.nextToken();

View File

@ -345,7 +345,9 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
public I2PSocket createI2PSocket(Destination dest) throws I2PException, ConnectException, NoRouteToHostException, InterruptedIOException {
if (sockMgr == null) {
// we need this before getDefaultOptions()
sockMgr = getSocketManager();
synchronized(sockLock) {
sockMgr = getSocketManager();
}
}
return createI2PSocket(dest, getDefaultOptions());
}
@ -369,9 +371,12 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
if (sockMgr == null) {
// delayed open - call get instead of build because the locking is up there
sockMgr = getSocketManager();
} else if (Boolean.valueOf(getTunnel().getClientOptions().getProperty("i2cp.newDestOnResume")).booleanValue()) {
synchronized(sockMgr) {
synchronized(sockLock) {
sockMgr = getSocketManager();
}
} else if (Boolean.valueOf(getTunnel().getClientOptions().getProperty("i2cp.closeOnIdle")).booleanValue() &&
Boolean.valueOf(getTunnel().getClientOptions().getProperty("i2cp.newDestOnResume")).booleanValue()) {
synchronized(sockLock) {
I2PSocketManager oldSockMgr = sockMgr;
// This will build a new socket manager and a new dest if the session is closed.
sockMgr = getSocketManager();

View File

@ -211,8 +211,11 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
if (!defaultOpts.contains("i2p.streaming.inactivityTimeout"))
defaultOpts.setProperty("i2p.streaming.inactivityTimeout", ""+DEFAULT_READ_TIMEOUT);
// delayed start
if (sockMgr == null)
sockMgr = getSocketManager();
if (sockMgr == null) {
synchronized(sockLock) {
sockMgr = getSocketManager();
}
}
I2PSocketOptions opts = sockMgr.buildOptions(defaultOpts);
if (!defaultOpts.containsKey(I2PSocketOptions.PROP_CONNECT_TIMEOUT))
opts.setConnectTimeout(DEFAULT_CONNECT_TIMEOUT);

View File

@ -153,7 +153,9 @@ public class EditBean extends IndexBean {
}
public boolean getNewDest(int tunnel) {
return getBooleanProperty(tunnel, "i2cp.newDestOnResume");
return getBooleanProperty(tunnel, "i2cp.newDestOnResume") &&
getBooleanProperty(tunnel, "i2cp.closeOnIdle") &&
!getBooleanProperty(tunnel, "persistentClientKey");
}
public boolean getPersistentClientKey(int tunnel) {

View File

@ -135,7 +135,7 @@ public class SummaryHelper extends HelperBase {
return "ERR-UDP Port In Use - Set i2np.udp.internalPort=xxxx in advanced config and restart";
case CommSystemFacade.STATUS_UNKNOWN: // fallthrough
default:
ra = _context.router().getRouterInfo().getTargetAddress("UDP");
ra = _context.router().getRouterInfo().getTargetAddress("SSU");
if (ra == null && _context.router().getUptime() > 5*60*1000) {
if (_context.getProperty(ConfigNetHelper.PROP_I2NP_NTCP_HOSTNAME) == null ||
_context.getProperty(ConfigNetHelper.PROP_I2NP_NTCP_PORT) == null)

View File

@ -17,6 +17,8 @@
I2P <jsp:getProperty name="helper" property="version" /><br />
<%=System.getProperty("java.vendor")%> <%=System.getProperty("java.version")%><br />
<%=System.getProperty("os.name")%> <%=System.getProperty("os.arch")%> <%=System.getProperty("os.version")%><br />
CPU <%=net.i2p.util.NativeBigInteger.cpuModel()%> (<%=net.i2p.util.NativeBigInteger.cpuType()%>)<br />
jbigi <%=net.i2p.util.NativeBigInteger.loadStatus()%><br />
</p>
<hr />
<jsp:useBean class="net.i2p.router.web.LogsHelper" id="logsHelper" scope="request" />

View File

@ -37,7 +37,7 @@
<echo message="Ignore any warning about /WEB-INF/web.xml not found" />
<java classname="org.apache.jasper.JspC" fork="true" classpathref="cp">
<arg value="-d" />
<arg value="WEB-INF/classes" />
<arg value="${tmp}" />
<arg value="-v" />
<arg value="-p" />
<arg value="i2p.susi.dns.jsp" />
@ -47,7 +47,7 @@
<arg value="./jsp" />
</java>
<javac debug="true" deprecation="on" source="1.5" target="1.5"
destdir="${bin}" srcdir="./WEB-INF/classes" includes="**/*.java" classpathref="cp">
destdir="${bin}" srcdir="${tmp}" includes="**/*.java" classpathref="cp">
<compilerarg line="${javac.compilerargs}" />
</javac>
<copy file="WEB-INF/web-template.xml" tofile="WEB-INF/web-out.xml" />
@ -85,6 +85,7 @@
<fileset dir="WEB-INF" includes="web-fragment.xml, web-out.xml" />
</delete>
<delete dir="${bin}" />
<delete dir="${tmp}" />
</target>
<target name="distclean" depends="clean" />
</project>

View File

@ -323,6 +323,14 @@
<tarfileset dir="pkg-temp" includes="**/*" prefix="i2p" />
</tar>
</target>
<target name="consoleDocs">
<delete dir="pkg-temp" />
<copy todir="pkg-temp/docs/" >
<fileset dir="." includes="readme*.html" />
<fileset dir="installer/resources/" includes="*-header.ht" />
</copy>
<zip destfile="docs.zip" basedir="pkg-temp" />
</target>
<target name="updater" depends="prepupdate">
<zip destfile="i2pupdate.zip" basedir="pkg-temp" />
</target>
@ -373,8 +381,10 @@
<copy file="build/routerconsole.war" todir="pkg-temp/webapps/" />
<copy file="build/addressbook.war" todir="pkg-temp/webapps/" />
<!-- New readme_*.html files - For one release only -->
<!--
<mkdir dir="pkg-temp/docs" />
<copy file="readme_fr.html" todir="pkg-temp/docs/" />
-->
</target>
<target name="prepupdateRouter" depends="buildrouter">
<delete dir="pkg-temp" />

View File

@ -325,6 +325,7 @@ class TransientSessionKeyManager extends SessionKeyManager {
int recent = 0;
int tags = 0;
int toRemove = overage * 2;
_log.log(Log.CRIT, "TOO MANY SESSION TAGS! Starting cleanup, overage = " + overage);
List removed = new ArrayList(toRemove);
synchronized (_inboundTagSets) {
for (Iterator iter = _inboundTagSets.values().iterator(); iter.hasNext(); ) {

View File

@ -143,7 +143,6 @@ public class I2CPMessageReader {
_log.error("Error closing the stream", ioe);
}
}
_stream = null;
}
public void run() {
@ -186,7 +185,7 @@ public class I2CPMessageReader {
}
}
}
// boom bye bye bad bwoy
_stream = null;
}
}
}

View File

@ -88,6 +88,8 @@ import net.i2p.util.Log;
public class NativeBigInteger extends BigInteger {
/** did we load the native lib correctly? */
private static boolean _nativeOk = false;
private static String _loadStatus = "uninitialized";
private static String _cpuModel = "uninitialized";
/**
* do we want to dump some basic success/failure info to stderr during
* initialization? this would otherwise use the Log component, but this makes
@ -140,6 +142,9 @@ public class NativeBigInteger extends BigInteger {
try {
CPUInfo c = CPUID.getInfo();
try {
_cpuModel = c.getCPUModelString();
} catch (UnknownCPUException e) {}
if (c.IsC3Compatible())
return JBIGI_OPTIMIZATION_VIAC3;
if (c instanceof AMDCPUInfo) {
@ -256,6 +261,20 @@ public class NativeBigInteger extends BigInteger {
return _nativeOk;
}
public static String loadStatus() {
return _loadStatus;
}
public static String cpuType() {
if (sCPUType != null)
return sCPUType;
return "unrecognized";
}
public static String cpuModel() {
return _cpuModel;
}
/**
* <p>Compare the BigInteger.modPow/doubleValue vs the NativeBigInteger.modPow/doubleValue of some
* really big (2Kbit) numbers 100 different times and benchmark the
@ -455,12 +474,14 @@ public class NativeBigInteger extends BigInteger {
if(_doLog)
System.err.println("INFO: " + s);
I2PAppContext.getGlobalContext().logManager().getLog(NativeBigInteger.class).info(s);
_loadStatus = s;
}
private static void warn(String s) {
if(_doLog)
System.err.println("WARNING: " + s);
I2PAppContext.getGlobalContext().logManager().getLog(NativeBigInteger.class).warn(s);
_loadStatus = s;
}
/**

View File

@ -34,6 +34,7 @@ public class ShellCommand {
private static final boolean NO_WAIT_FOR_EXIT_STATUS = false;
private boolean _commandSuccessful;
private boolean _commandCompleted;
private CommandThread _commandThread;
private InputStream _errorStream;
private InputStream _inputStream;
@ -43,6 +44,8 @@ public class ShellCommand {
/**
* Executes a shell command in its own thread.
* Use caution when repeatedly calling execute methods with the same object
* as there are some globals here...
*
* @author hypercubus
*/
@ -57,11 +60,16 @@ public class ShellCommand {
this.caller = caller;
this.shellCommand = shellCommand;
this.consumeOutput = consumeOutput;
_commandSuccessful = false;
_commandCompleted = false;
}
@Override
public void run() {
// FIXME these will corrupt the globals if the command times out and the caller
// makes another request with the same object.
_commandSuccessful = execute(shellCommand, consumeOutput, WAIT_FOR_EXIT_STATUS);
_commandCompleted = true;
if (_isTimerRunning) {
synchronized(caller) {
caller.notifyAll(); // In case the caller is still in the wait() state.
@ -248,7 +256,8 @@ public class ShellCommand {
_isTimerRunning = true;
wait(seconds * 1000);
_isTimerRunning = false;
return true;
if (!_commandCompleted)
return true;
}
} catch (InterruptedException e) {
@ -317,7 +326,8 @@ public class ShellCommand {
_isTimerRunning = true;
wait(seconds * 1000);
_isTimerRunning = false;
return true;
if (!_commandCompleted)
return true;
}
} catch (InterruptedException e) {

View File

@ -28,7 +28,7 @@ clientApp.3.startOnLoad=true
clientApp.4.main=net.i2p.apps.systray.UrlLauncher
clientApp.4.name=consoleBrowser
clientApp.4.args=http://127.0.0.1:7657/index.jsp
clientApp.4.delay=5
clientApp.4.delay=15
clientApp.4.startOnLoad=true
# BOB bridge

View File

@ -59,10 +59,10 @@ class CreateSessionJob extends JobImpl {
// XXX props.putAll(Router.getInstance().getConfigMap());
// override them by the client's settings
props.putAll(_runner.getConfig().getOptions());
props.putAll(cfg.getOptions());
// and load 'em up (using anything not yet set as the software defaults)
settings.readFromProperties(props);
getContext().tunnelManager().buildTunnels(_runner.getConfig().getDestination(), settings);
getContext().tunnelManager().buildTunnels(cfg.getDestination(), settings);
}
}