From 9cc1511863435d7d0141ca946f200af5d1a63516 Mon Sep 17 00:00:00 2001
From: zzz
Date: Mon, 27 Apr 2009 17:37:29 +0000
Subject: [PATCH 01/10] fix up susidns build file so it will work with gcj
---
apps/susidns/src/build.xml | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/apps/susidns/src/build.xml b/apps/susidns/src/build.xml
index be34b4879..6f82b26b1 100644
--- a/apps/susidns/src/build.xml
+++ b/apps/susidns/src/build.xml
@@ -37,7 +37,7 @@
-
+
@@ -47,7 +47,7 @@
+ destdir="${bin}" srcdir="${tmp}" includes="**/*.java" classpathref="cp">
@@ -85,6 +85,7 @@
+
From f5bd10207bf9d6a1e015508d25649bb0c656f451 Mon Sep 17 00:00:00 2001
From: zzz
Date: Tue, 28 Apr 2009 13:43:48 +0000
Subject: [PATCH 02/10] log before a hang maybe (SWAG)
---
core/java/src/net/i2p/crypto/TransientSessionKeyManager.java | 1 +
1 file changed, 1 insertion(+)
diff --git a/core/java/src/net/i2p/crypto/TransientSessionKeyManager.java b/core/java/src/net/i2p/crypto/TransientSessionKeyManager.java
index 0d71677a9..80cd18ac8 100644
--- a/core/java/src/net/i2p/crypto/TransientSessionKeyManager.java
+++ b/core/java/src/net/i2p/crypto/TransientSessionKeyManager.java
@@ -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(); ) {
From 9ae4fce0dbecd89bf38d092871d718bc09e31e34 Mon Sep 17 00:00:00 2001
From: zzz
Date: Thu, 30 Apr 2009 14:53:46 +0000
Subject: [PATCH 03/10] new consoleDocs target
---
build.xml | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/build.xml b/build.xml
index 453b0d44c..6ed84ca73 100644
--- a/build.xml
+++ b/build.xml
@@ -323,6 +323,14 @@
+
+
+
+
+
+
+
+
@@ -373,8 +381,10 @@
+
From c3bafcab05e26a47ceb441df505c2f0877ffcae9 Mon Sep 17 00:00:00 2001
From: zzz
Date: Thu, 30 Apr 2009 14:56:25 +0000
Subject: [PATCH 04/10] put jbigi info on logs.jsp
---
apps/routerconsole/jsp/logs.jsp | 2 ++
.../src/net/i2p/util/NativeBigInteger.java | 21 +++++++++++++++++++
2 files changed, 23 insertions(+)
diff --git a/apps/routerconsole/jsp/logs.jsp b/apps/routerconsole/jsp/logs.jsp
index a10291248..dbaca0403 100644
--- a/apps/routerconsole/jsp/logs.jsp
+++ b/apps/routerconsole/jsp/logs.jsp
@@ -17,6 +17,8 @@
I2P
<%=System.getProperty("java.vendor")%> <%=System.getProperty("java.version")%>
<%=System.getProperty("os.name")%> <%=System.getProperty("os.arch")%> <%=System.getProperty("os.version")%>
+CPU <%=net.i2p.util.NativeBigInteger.cpuModel()%> (<%=net.i2p.util.NativeBigInteger.cpuType()%>)
+jbigi <%=net.i2p.util.NativeBigInteger.loadStatus()%>
diff --git a/core/java/src/net/i2p/util/NativeBigInteger.java b/core/java/src/net/i2p/util/NativeBigInteger.java
index 970de52c8..a6d7e9792 100644
--- a/core/java/src/net/i2p/util/NativeBigInteger.java
+++ b/core/java/src/net/i2p/util/NativeBigInteger.java
@@ -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;
+ }
+
/**
* 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;
}
/**
From 5a6b65d20ce8a87e0472b31b0b6efb1f57140eaa Mon Sep 17 00:00:00 2001
From: zzz
Date: Thu, 30 Apr 2009 18:06:51 +0000
Subject: [PATCH 05/10] * URL Launcher: - Launcher on linux was stopping
after trying opera, whether it succeeded or failed. Now it keeps going to
try firefox, etc. as designed.
---
core/java/src/net/i2p/util/ShellCommand.java | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/core/java/src/net/i2p/util/ShellCommand.java b/core/java/src/net/i2p/util/ShellCommand.java
index 36f0dfd21..80bdc32f6 100644
--- a/core/java/src/net/i2p/util/ShellCommand.java
+++ b/core/java/src/net/i2p/util/ShellCommand.java
@@ -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) {
From becc6dc0fcbe70107b0d309f5500be230ebe76b6 Mon Sep 17 00:00:00 2001
From: zzz
Date: Fri, 1 May 2009 00:54:09 +0000
Subject: [PATCH 06/10] extend browser launch delay from 5s to 15s
---
installer/resources/clients.config | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/installer/resources/clients.config b/installer/resources/clients.config
index 9d0c1b583..170f4c8fe 100644
--- a/installer/resources/clients.config
+++ b/installer/resources/clients.config
@@ -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
From 4139b36eac3f5e7eac7c5779028a73da793519eb Mon Sep 17 00:00:00 2001
From: zzz
Date: Fri, 1 May 2009 11:58:14 +0000
Subject: [PATCH 07/10] fix race NPE
---
router/java/src/net/i2p/router/client/CreateSessionJob.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/router/java/src/net/i2p/router/client/CreateSessionJob.java b/router/java/src/net/i2p/router/client/CreateSessionJob.java
index 11608980d..0ee1f177f 100644
--- a/router/java/src/net/i2p/router/client/CreateSessionJob.java
+++ b/router/java/src/net/i2p/router/client/CreateSessionJob.java
@@ -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);
}
}
From d3181e53cc4196695494e4552e93fff6715dcff2 Mon Sep 17 00:00:00 2001
From: zzz
Date: Fri, 1 May 2009 12:14:31 +0000
Subject: [PATCH 08/10] prevent race NPE
---
core/java/src/net/i2p/data/i2cp/I2CPMessageReader.java | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/core/java/src/net/i2p/data/i2cp/I2CPMessageReader.java b/core/java/src/net/i2p/data/i2cp/I2CPMessageReader.java
index 79066c4c6..5c79d94f3 100644
--- a/core/java/src/net/i2p/data/i2cp/I2CPMessageReader.java
+++ b/core/java/src/net/i2p/data/i2cp/I2CPMessageReader.java
@@ -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;
}
}
}
From 4c396e5b9526134ec97e7011bb26c1e43736fd98 Mon Sep 17 00:00:00 2001
From: zzz
Date: Fri, 1 May 2009 12:31:38 +0000
Subject: [PATCH 09/10] Console: fix ERR-UDP Disabled and Inbound TCP host/port
not set
---
apps/desktopgui/src/router/configuration/PeerHelper.java | 2 +-
.../java/src/net/i2p/router/web/SummaryHelper.java | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/apps/desktopgui/src/router/configuration/PeerHelper.java b/apps/desktopgui/src/router/configuration/PeerHelper.java
index 54d71cbc2..76ffeef87 100644
--- a/apps/desktopgui/src/router/configuration/PeerHelper.java
+++ b/apps/desktopgui/src/router/configuration/PeerHelper.java
@@ -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)
diff --git a/apps/routerconsole/java/src/net/i2p/router/web/SummaryHelper.java b/apps/routerconsole/java/src/net/i2p/router/web/SummaryHelper.java
index a275e2a61..f85d8dc93 100644
--- a/apps/routerconsole/java/src/net/i2p/router/web/SummaryHelper.java
+++ b/apps/routerconsole/java/src/net/i2p/router/web/SummaryHelper.java
@@ -48,7 +48,7 @@ public class SummaryHelper extends HelperBase {
*
*/
public String getVersion() {
- return RouterVersion.VERSION + "-" + RouterVersion.BUILD;
+ return RouterVersion.FULL_VERSION;
}
/**
* Retrieve a pretty printed uptime count (ala 4d or 7h or 39m)
@@ -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)
From a8a0e2a91c31d28fb9c9ad7df752de7b1ac9f56a Mon Sep 17 00:00:00 2001
From: zzz
Date: Fri, 1 May 2009 12:43:19 +0000
Subject: [PATCH 10/10] * I2PTunnel: - Try to fix locking to prevent
duplicate destinations when using the new option new-dest-on-resume.
Still not right for shared clients but should be better for non-shared.
---
.../java/src/net/i2p/i2ptunnel/I2PTunnelClient.java | 2 +-
.../src/net/i2p/i2ptunnel/I2PTunnelClientBase.java | 13 +++++++++----
.../src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java | 7 +++++--
.../java/src/net/i2p/i2ptunnel/web/EditBean.java | 4 +++-
4 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelClient.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelClient.java
index 12931f3a2..36edc0766 100644
--- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelClient.java
+++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelClient.java
@@ -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();
diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelClientBase.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelClientBase.java
index c4eafde50..3c571857a 100644
--- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelClientBase.java
+++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelClientBase.java
@@ -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();
diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java
index 53c3136b2..316731dee 100644
--- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java
+++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java
@@ -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);
diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/EditBean.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/EditBean.java
index a029de725..d606467c5 100644
--- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/EditBean.java
+++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/EditBean.java
@@ -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) {