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 390a37e4d..dec2d7891 100644
--- a/apps/routerconsole/java/src/net/i2p/router/web/SummaryHelper.java
+++ b/apps/routerconsole/java/src/net/i2p/router/web/SummaryHelper.java
@@ -10,6 +10,7 @@ import java.util.Set;
import net.i2p.data.DataHelper;
import net.i2p.data.Destination;
import net.i2p.data.LeaseSet;
+import net.i2p.data.RouterAddress;
import net.i2p.stat.Rate;
import net.i2p.stat.RateStat;
import net.i2p.router.CommSystemFacade;
@@ -17,6 +18,7 @@ import net.i2p.router.Router;
import net.i2p.router.RouterContext;
import net.i2p.router.RouterVersion;
import net.i2p.router.TunnelPoolSettings;
+import net.i2p.router.transport.ntcp.NTCPAddress;
/**
* Simple helper to query the appropriate router for data necessary to render
@@ -120,7 +122,10 @@ public class SummaryHelper {
int status = _context.commSystem().getReachabilityStatus();
switch (status) {
case CommSystemFacade.STATUS_OK:
- return "OK";
+ RouterAddress ra = _context.router().getRouterInfo().getTargetAddress("NTCP");
+ if (ra == null || (new NTCPAddress(ra)).isPubliclyRoutable())
+ return "OK";
+ return "ERR-Private TCP Address";
case CommSystemFacade.STATUS_DIFFERENT:
return "ERR-SymmetricNAT";
case CommSystemFacade.STATUS_REJECT_UNSOLICITED:
@@ -514,6 +519,28 @@ public class SummaryHelper {
return String.valueOf(_context.tunnelManager().getInboundBuildQueueSize());
}
+ public String getPRNGStatus() {
+ Rate r = _context.statManager().getRate("prng.bufferWaitTime").getRate(60*1000);
+ int use = (int) r.getLastEventCount();
+ int i = (int) (r.getAverageValue() + 0.5);
+ if (i <= 0) {
+ r = _context.statManager().getRate("prng.bufferWaitTime").getRate(10*60*1000);
+ i = (int) (r.getAverageValue() + 0.5);
+ }
+ String rv = i + "/";
+ r = _context.statManager().getRate("prng.bufferFillTime").getRate(60*1000);
+ i = (int) (r.getAverageValue() + 0.5);
+ if (i <= 0) {
+ r = _context.statManager().getRate("prng.bufferFillTime").getRate(10*60*1000);
+ i = (int) (r.getAverageValue() + 0.5);
+ }
+ rv = rv + i + "ms";
+ // margin == fill time / use time
+ if (use > 0 && i > 0)
+ rv = rv + ' ' + (60*1000 / (use * i)) + 'x';
+ return rv;
+ }
+
public boolean updateAvailable() {
return NewsFetcher.getInstance(_context).updateAvailable();
}
diff --git a/apps/routerconsole/jsp/summary.jsp b/apps/routerconsole/jsp/summary.jsp
index 1f284c64b..7bd85aaf9 100644
--- a/apps/routerconsole/jsp/summary.jsp
+++ b/apps/routerconsole/jsp/summary.jsp
@@ -95,6 +95,7 @@
Message delay:
Tunnel lag:
Handle backlog:
+ PRNG wait/fill:
diff --git a/core/java/src/gnu/crypto/prng/AsyncFortunaStandalone.java b/core/java/src/gnu/crypto/prng/AsyncFortunaStandalone.java
index 90d8d97d7..c7b5c36e5 100644
--- a/core/java/src/gnu/crypto/prng/AsyncFortunaStandalone.java
+++ b/core/java/src/gnu/crypto/prng/AsyncFortunaStandalone.java
@@ -2,6 +2,8 @@ package gnu.crypto.prng;
import java.util.*;
+import net.i2p.I2PAppContext;
+
/**
* fortuna instance that tries to avoid blocking if at all possible by using separate
* filled buffer segments rather than one buffer (and blocking when that buffer's data
@@ -13,16 +15,20 @@ public class AsyncFortunaStandalone extends FortunaStandalone implements Runnabl
private final byte asyncBuffers[][] = new byte[BUFFERS][BUFSIZE];
private final int status[] = new int[BUFFERS];
private int nextBuf = 0;
+ private I2PAppContext _context;
private static final int STATUS_NEED_FILL = 0;
private static final int STATUS_FILLING = 1;
private static final int STATUS_FILLED = 2;
private static final int STATUS_LIVE = 3;
- public AsyncFortunaStandalone() {
+ public AsyncFortunaStandalone(I2PAppContext context) {
super();
for (int i = 0; i < BUFFERS; i++)
status[i] = STATUS_NEED_FILL;
+ _context = context;
+ context.statManager().createRateStat("prng.bufferWaitTime", "", "Encryption", new long[] { 60*1000, 10*60*1000, 60*60*1000 } );
+ context.statManager().createRateStat("prng.bufferFillTime", "", "Encryption", new long[] { 60*1000, 10*60*1000, 60*60*1000 } );
}
public void startup() {
@@ -61,6 +67,7 @@ public class AsyncFortunaStandalone extends FortunaStandalone implements Runnabl
} catch (InterruptedException ie) {}
waited = System.currentTimeMillis()-before;
}
+ _context.statManager().addRateData("prng.bufferWaitTime", waited, 0);
if (waited > 10*1000)
System.out.println(Thread.currentThread().getName() + ": Took " + waited
+ "ms for a full PRNG buffer to be found");
@@ -108,6 +115,7 @@ public class AsyncFortunaStandalone extends FortunaStandalone implements Runnabl
//System.out.println(Thread.currentThread().getName() + ": Prng buffer " + toFill + " filled after " + (after-before));
asyncBuffers.notifyAll();
}
+ _context.statManager().addRateData("prng.bufferFillTime", after - before, 0);
Thread.yield();
long waitTime = (after-before)*5;
if (waitTime <= 0) // somehow postman saw waitTime show up as negative
@@ -147,7 +155,7 @@ public class AsyncFortunaStandalone extends FortunaStandalone implements Runnabl
public static void main(String args[]) {
try {
- AsyncFortunaStandalone rand = new AsyncFortunaStandalone();
+ AsyncFortunaStandalone rand = new AsyncFortunaStandalone(null); // Will cause NPEs above; fix this if you want to test! Sorry...
byte seed[] = new byte[1024];
rand.seed(seed);
diff --git a/core/java/src/net/i2p/stat/StatManager.java b/core/java/src/net/i2p/stat/StatManager.java
index 07cce24ef..3f3ab4a72 100644
--- a/core/java/src/net/i2p/stat/StatManager.java
+++ b/core/java/src/net/i2p/stat/StatManager.java
@@ -37,13 +37,15 @@ public class StatManager {
public static final String PROP_STAT_REQUIRED = "stat.required";
/**
* These are all the stats published in netDb, plus those required for the operation of
- * the router (many in RouterThrottleImpl), plus those that are on graphs.jsp by default.
+ * the router (many in RouterThrottleImpl), plus those that are on graphs.jsp by default,
+ * plus those used on the summary bar (SummaryHelper.java).
* Wildcard ('*') allowed at end of stat only.
* Ignore all the rest of the stats unless stat.full=true.
*/
public static final String DEFAULT_STAT_REQUIRED =
"bw.recvRate,bw.sendBps,bw.sendRate,client.sendAckTime,clock.skew,crypto.elGamal.encrypt," +
"jobQueue.jobLag,netDb.successTime,router.fastPeers," +
+ "prng.bufferFillTime,prng.bufferWaitTime," +
"transport.receiveMessageSize,transport.sendMessageSize,transport.sendProcessingTime," +
"tunnel.acceptLoad,tunnel.buildRequestTime,tunnel.rejectOverloaded,tunnel.rejectTimeout" +
"tunnel.buildClientExpire,tunnel.buildClientReject,tunnel.buildClientSuccess," +
diff --git a/core/java/src/net/i2p/util/FortunaRandomSource.java b/core/java/src/net/i2p/util/FortunaRandomSource.java
index 2d1a69196..865cc0bb4 100644
--- a/core/java/src/net/i2p/util/FortunaRandomSource.java
+++ b/core/java/src/net/i2p/util/FortunaRandomSource.java
@@ -32,7 +32,7 @@ public class FortunaRandomSource extends RandomSource implements EntropyHarveste
public FortunaRandomSource(I2PAppContext context) {
super(context);
- _fortuna = new AsyncFortunaStandalone();
+ _fortuna = new AsyncFortunaStandalone(context);
byte seed[] = new byte[1024];
if (initSeed(seed)) {
_fortuna.seed(seed);
diff --git a/history.txt b/history.txt
index 548470b42..a3e13b7e9 100644
--- a/history.txt
+++ b/history.txt
@@ -1,3 +1,11 @@
+2008-06-23 zzz
+ * configclients.jsp: Add start button for clients and webapps.
+ * PRNG: Add two stats
+ * Summary bar:
+ - Display Warning for TCP private IP address
+ - Display PRNG stats
+ * OutNetMessage: Change cache logging from WARN to INFO
+
2008-06-17 zzz
* Comm System: Add new STATUS_HOSED for use when UDP bind fails
* Summary bar: Display helpful errror message when UDP bind fails
diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java
index 01f475f2a..9cea22605 100644
--- a/router/java/src/net/i2p/router/RouterVersion.java
+++ b/router/java/src/net/i2p/router/RouterVersion.java
@@ -17,7 +17,7 @@ import net.i2p.CoreVersion;
public class RouterVersion {
public final static String ID = "$Revision: 1.548 $ $Date: 2008-06-07 23:00:00 $";
public final static String VERSION = "0.6.2";
- public final static long BUILD = 4;
+ public final static long BUILD = 5;
public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
System.out.println("Router ID: " + RouterVersion.ID);