diff --git a/apps/routerconsole/java/src/net/i2p/router/web/UpdateHandler.java b/apps/routerconsole/java/src/net/i2p/router/web/UpdateHandler.java
index 3f0a9bed80..02d92dcf05 100644
--- a/apps/routerconsole/java/src/net/i2p/router/web/UpdateHandler.java
+++ b/apps/routerconsole/java/src/net/i2p/router/web/UpdateHandler.java
@@ -162,7 +162,8 @@ public class UpdateHandler {
_status = "Update verified
Restarting
";
restart();
} else {
- _log.log(Log.CRIT, "Update was INVALID - have you changed your keys?");
+ _log.log(Log.CRIT, "Update was INVALID - signing key is not trusted!");
+ _status = "Update signing key invalid
";
System.setProperty("net.i2p.router.web.UpdateHandler.updateInProgress", "false");
}
}
diff --git a/history.txt b/history.txt
index e50e8b2beb..78a2c5e4d5 100644
--- a/history.txt
+++ b/history.txt
@@ -1,3 +1,11 @@
+2008-02-17 zzz
+ * PersistentDataStore: Write out 300 records every 10 min
+ rather than 1 every 10 sec;
+ Don't store leasesets to disk or read them in
+ * Combine rates for pools with the same length setting
+ in the new tunnel build algorithm
+ * Clarify a log message in the UpdateHandler
+
2008-02-13 zzz
* Make graphs clickable to get larger graphs
* Change SimpleTimer CRIT to a WARN, increase threshold
diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java
index 8833032784..2747fbe052 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-02-10 15:00:00 $";
public final static String VERSION = "0.6.1.31";
- public final static long BUILD = 2;
+ public final static long BUILD = 3;
public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
System.out.println("Router ID: " + RouterVersion.ID);
diff --git a/router/java/src/net/i2p/router/networkdb/kademlia/PersistentDataStore.java b/router/java/src/net/i2p/router/networkdb/kademlia/PersistentDataStore.java
index 5576847706..3e0e4c6960 100644
--- a/router/java/src/net/i2p/router/networkdb/kademlia/PersistentDataStore.java
+++ b/router/java/src/net/i2p/router/networkdb/kademlia/PersistentDataStore.java
@@ -66,7 +66,9 @@ class PersistentDataStore extends TransientDataStore {
public void put(Hash key, DataStructure data) {
if ( (data == null) || (key == null) ) return;
super.put(key, data);
- _writer.queue(key, data);
+ // Don't bother writing LeaseSets to disk
+ if (data instanceof RouterInfo)
+ _writer.queue(key, data);
}
public int countLeaseSets() {
@@ -103,7 +105,7 @@ class PersistentDataStore extends TransientDataStore {
}
public String getName() { return "Remove Key"; }
public void runJob() {
- _log.info("Removing key " + _key, getAddedBy());
+ _log.info("Removing key " + _key /* , getAddedBy() */);
try {
File dbDir = getDbDir();
removeFile(_key, dbDir);
@@ -113,6 +115,9 @@ class PersistentDataStore extends TransientDataStore {
}
}
+ /*
+ * Queue up writes, write up to 300 files every 10 minutes
+ */
private class Writer implements Runnable {
private Map _keys;
private List _keyOrder;
@@ -137,12 +142,15 @@ class PersistentDataStore extends TransientDataStore {
public void run() {
Hash key = null;
DataStructure data = null;
+ int count = 0;
while (true) { // hmm, probably want a shutdown handle... though this is a daemon thread
try {
synchronized (_keys) {
if (_keyOrder.size() <= 0) {
+ count = 0;
_keys.wait();
} else {
+ count++;
key = (Hash)_keyOrder.remove(0);
data = (DataStructure)_keys.remove(key);
}
@@ -153,7 +161,10 @@ class PersistentDataStore extends TransientDataStore {
write(key, data);
key = null;
data = null;
- try { Thread.sleep(10*1000); } catch (InterruptedException ie) {}
+ if (count >= 300)
+ count = 0;
+ if (count == 0)
+ try { Thread.sleep(10*60*1000); } catch (InterruptedException ie) {}
}
}
}
@@ -227,6 +238,7 @@ class PersistentDataStore extends TransientDataStore {
int routerCount = 0;
try {
File dbDir = getDbDir();
+/****
if (getContext().router().getUptime() < 10*60*1000) {
File leaseSetFiles[] = dbDir.listFiles(LeaseSetFilter.getInstance());
if (leaseSetFiles != null) {
@@ -237,6 +249,7 @@ class PersistentDataStore extends TransientDataStore {
}
}
}
+****/
File routerInfoFiles[] = dbDir.listFiles(RouterInfoFilter.getInstance());
if (routerInfoFiles != null) {
routerCount += routerInfoFiles.length;
@@ -259,6 +272,7 @@ class PersistentDataStore extends TransientDataStore {
}
}
+/****
private class ReadLeaseJob extends JobImpl {
private File _leaseFile;
private Hash _key;
@@ -313,6 +327,7 @@ class PersistentDataStore extends TransientDataStore {
}
}
}
+****/
private class ReadRouterJob extends JobImpl {
private File _routerFile;
diff --git a/router/java/src/net/i2p/router/tunnel/pool/TunnelPool.java b/router/java/src/net/i2p/router/tunnel/pool/TunnelPool.java
index 6faa1abbd7..ed3d1199a4 100644
--- a/router/java/src/net/i2p/router/tunnel/pool/TunnelPool.java
+++ b/router/java/src/net/i2p/router/tunnel/pool/TunnelPool.java
@@ -40,7 +40,6 @@ public class TunnelPool {
private long _lastRateUpdate;
private long _lastLifetimeProcessed;
private final String _rateName;
- private final String _buildStatName;
private static final int TUNNEL_LIFETIME = 10*60*1000;
public TunnelPool(RouterContext ctx, TunnelPoolManager mgr, TunnelPoolSettings settings, TunnelPeerSelector sel) {
@@ -61,9 +60,6 @@ public class TunnelPool {
_rateName = "tunnel.Bps." +
(_settings.isExploratory() ? "exploratory" : _settings.getDestinationNickname()) +
(_settings.isInbound() ? ".in" : ".out");
- _buildStatName = "tunnel.build." +
- (_settings.isExploratory() ? "exploratory" : _settings.getDestinationNickname()) +
- (_settings.isInbound() ? ".in" : ".out");
refreshSettings();
}
@@ -87,9 +83,6 @@ public class TunnelPool {
_context.statManager().createRateStat(_rateName,
"Tunnel Bandwidth", "Tunnels",
new long[] { 5*60*1000l });
- _context.statManager().createRateStat(_buildStatName,
- "Tunnel Build Frequency", "Tunnels",
- new long[] { TUNNEL_LIFETIME });
}
public void shutdown() {
@@ -460,6 +453,17 @@ public class TunnelPool {
public long getLifetimeProcessed() { return _lifetimeProcessed; }
+ /**
+ * Keep a separate stat for each type, direction, and length of tunnel.
+ */
+ private final String buildRateName() {
+ if (_settings.isExploratory())
+ return "tunnel.buildRatio.exploratory." + (_settings.isInbound() ? "in" : "out");
+ else
+ return "tunnel.buildRatio.l" + _settings.getLength() + "v" + _settings.getLengthVariance() +
+ (_settings.isInbound() ? ".in" : ".out");
+ }
+
/**
* Gather the data to see how many tunnels to build, and then actually compute that value (delegated to
* the countHowManyToBuild function below)
@@ -491,8 +495,17 @@ public class TunnelPool {
*
**/
+ // Compute the average time it takes us to build a single tunnel of this type.
int avg = 0;
- RateStat rs = _context.statManager().getRate(_buildStatName);
+ RateStat rs = _context.statManager().getRate(buildRateName());
+ if (rs == null) {
+ // Create the RateStat here rather than at the top because
+ // the user could change the length settings while running
+ _context.statManager().createRateStat(buildRateName(),
+ "Tunnel Build Frequency", "Tunnels",
+ new long[] { TUNNEL_LIFETIME });
+ rs = _context.statManager().getRate(buildRateName());
+ }
if (rs != null) {
Rate r = rs.getRate(TUNNEL_LIFETIME);
if (r != null)
@@ -568,7 +581,7 @@ public class TunnelPool {
+ " soon " + expireSoon + " later " + expireLater
+ " std " + wanted + " inProgress " + inProgress + " fallback " + fallback
+ " for " + toString());
- _context.statManager().addRateData(_buildStatName, rv + inProgress, 0);
+ _context.statManager().addRateData(buildRateName(), rv + inProgress, 0);
return rv;
}
@@ -622,7 +635,7 @@ public class TunnelPool {
int rv = countHowManyToBuild(allowZeroHop, expire30s, expire90s, expire150s, expire210s, expire270s,
expireLater, wanted, inProgress, fallback);
- _context.statManager().addRateData(_buildStatName, (rv > 0 || inProgress > 0) ? 1 : 0, 0);
+ _context.statManager().addRateData(buildRateName(), (rv > 0 || inProgress > 0) ? 1 : 0, 0);
return rv;
}