diff --git a/core/java/src/gnu/crypto/prng/AsyncFortunaStandalone.java b/core/java/src/gnu/crypto/prng/AsyncFortunaStandalone.java index e84827389..90d8d97d7 100644 --- a/core/java/src/gnu/crypto/prng/AsyncFortunaStandalone.java +++ b/core/java/src/gnu/crypto/prng/AsyncFortunaStandalone.java @@ -52,8 +52,8 @@ public class AsyncFortunaStandalone extends FortunaStandalone implements Runnabl long before = System.currentTimeMillis(); long waited = 0; while (status[nextBuf] != STATUS_FILLED) { - System.out.println(Thread.currentThread().getName() + ": Next PRNG buffer " - + nextBuf + " isn't ready (" + status[nextBuf] + ")"); + //System.out.println(Thread.currentThread().getName() + ": Next PRNG buffer " + // + nextBuf + " isn't ready (" + status[nextBuf] + ")"); //new Exception("source").printStackTrace(); asyncBuffers.notifyAll(); try { @@ -61,7 +61,7 @@ public class AsyncFortunaStandalone extends FortunaStandalone implements Runnabl } catch (InterruptedException ie) {} waited = System.currentTimeMillis()-before; } - if (waited > 0) + if (waited > 10*1000) System.out.println(Thread.currentThread().getName() + ": Took " + waited + "ms for a full PRNG buffer to be found"); //System.out.println(Thread.currentThread().getName() + ": Switching to prng buffer " + nextBuf); diff --git a/history.txt b/history.txt index b86cf4985..aad65474a 100644 --- a/history.txt +++ b/history.txt @@ -1,4 +1,15 @@ -$Id: history.txt,v 1.513 2006-09-07 18:22:12 zzz Exp $ +$Id: history.txt,v 1.514 2006-09-07 18:26:53 zzz Exp $ + +2006-09-08 jrandom + * Tweak the PRNG logging so it only displays error messages if there are + problems + * Disable dynamic router keys for the time being, as they don't offer + meaningful security, may hurt the router, and makes it harder to + determine the network health. The code to restart on SSU IP change is + still enabled however. + * Disable tunnel load testing, leaning back on the tiered selection for + the time being. + * Spattering of bugfixes 2006-09-07 zzz * i2psnark: Increase output timeout from 2 min to 4 min diff --git a/router/java/src/net/i2p/router/LoadTestManager.java b/router/java/src/net/i2p/router/LoadTestManager.java index 4dac0cf6e..203af4b0d 100644 --- a/router/java/src/net/i2p/router/LoadTestManager.java +++ b/router/java/src/net/i2p/router/LoadTestManager.java @@ -78,7 +78,11 @@ public class LoadTestManager { private static final boolean DEFAULT_ENABLE = false; + /** disable all load testing for the moment */ + private static final boolean FORCE_DISABLE = true; + public static boolean isEnabled(I2PAppContext ctx) { + if (FORCE_DISABLE) return false; String enable = ctx.getProperty("router.enableLoadTesting"); if ( (DEFAULT_ENABLE) && (enable != null) && (!Boolean.valueOf(enable).booleanValue()) ) return false; @@ -130,6 +134,7 @@ public class LoadTestManager { * Actually send the messages through the given tunnel */ private void runTest(LoadTestTunnelConfig tunnel) { + if (!isEnabled(_context)) return; log(tunnel, "start"); int peerMessages = getPeerMessages(); if (_log.shouldLog(Log.DEBUG)) @@ -208,9 +213,17 @@ public class LoadTestManager { // this should take into consideration both the inbound and outbound tunnels // ... but it doesn't, yet. - _context.messageRegistry().registerPending(new Selector(tunnel, payloadMessage.getUniqueId()), - new SendAgain(_context, tunnel, payloadMessage.getUniqueId(), true), - new SendAgain(_context, tunnel, payloadMessage.getUniqueId(), false), + long uniqueId = -1; + if (payloadMessage != null) { + uniqueId = payloadMessage.getUniqueId(); + } else { + tunnel.logComplete(); + _active.remove(tunnel); + return; + } + _context.messageRegistry().registerPending(new Selector(tunnel, uniqueId), + new SendAgain(_context, tunnel, uniqueId, true), + new SendAgain(_context, tunnel, uniqueId, false), 10*1000); _context.tunnelDispatcher().dispatchOutbound(payloadMessage, outbound.getSendTunnelId(0), inbound.getReceiveTunnelId(0), diff --git a/router/java/src/net/i2p/router/Router.java b/router/java/src/net/i2p/router/Router.java index e8c5473a3..f9f3e8f04 100644 --- a/router/java/src/net/i2p/router/Router.java +++ b/router/java/src/net/i2p/router/Router.java @@ -240,8 +240,10 @@ public class Router { readConfig(); setupHandlers(); - if ("true".equalsIgnoreCase(_context.getProperty(Router.PROP_HIDDEN, "false"))) - killKeys(); + if (ALLOW_DYNAMIC_KEYS) { + if ("true".equalsIgnoreCase(_context.getProperty(Router.PROP_HIDDEN, "false"))) + killKeys(); + } _context.messageValidator().startup(); _context.tunnelDispatcher().startup(); @@ -815,11 +817,19 @@ public class Router { finalShutdown(exitCode); } + /** + * disable dynamic key functionality for the moment, as it may be harmful and doesn't + * add meaningful anonymity + */ + private static final boolean ALLOW_DYNAMIC_KEYS = false; + public void finalShutdown(int exitCode) { _log.log(Log.CRIT, "Shutdown(" + exitCode + ") complete", new Exception("Shutdown")); try { _context.logManager().shutdown(); } catch (Throwable t) { } - if ("true".equalsIgnoreCase(_context.getProperty(PROP_DYNAMIC_KEYS, "false"))) - killKeys(); + if (ALLOW_DYNAMIC_KEYS) { + if ("true".equalsIgnoreCase(_context.getProperty(PROP_DYNAMIC_KEYS, "false"))) + killKeys(); + } File f = new File(getPingFile()); f.delete(); @@ -1319,4 +1329,4 @@ class PersistRouterInfoJob extends JobImpl { if (fos != null) try { fos.close(); } catch (IOException ioe) {} } } -} \ No newline at end of file +} diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index 841a61e09..3ebb5d3ed 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -15,9 +15,9 @@ import net.i2p.CoreVersion; * */ public class RouterVersion { - public final static String ID = "$Revision: 1.451 $ $Date: 2006-09-06 01:32:53 $"; + public final static String ID = "$Revision: 1.452 $ $Date: 2006-09-07 18:03:18 $"; public final static String VERSION = "0.6.1.24"; - public final static long BUILD = 10; + public final static long BUILD = 11; 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/FloodOnlySearchJob.java b/router/java/src/net/i2p/router/networkdb/kademlia/FloodOnlySearchJob.java index 2a91300c1..8e03f827e 100644 --- a/router/java/src/net/i2p/router/networkdb/kademlia/FloodOnlySearchJob.java +++ b/router/java/src/net/i2p/router/networkdb/kademlia/FloodOnlySearchJob.java @@ -70,7 +70,7 @@ class FloodOnlySearchJob extends FloodSearchJob { return; } OutNetMessage out = getContext().messageRegistry().registerPending(_replySelector, _onReply, _onTimeout, _timeoutMs); - _out.add(out); + synchronized (_out) { _out.add(out); } for (int i = 0; _lookupsRemaining < CONCURRENT_SEARCHES && i < floodfillPeers.size(); i++) { Hash peer = (Hash)floodfillPeers.get(i); @@ -113,8 +113,10 @@ class FloodOnlySearchJob extends FloodSearchJob { if (_dead) return; _dead = true; } - for (int i = 0; i < _out.size(); i++) { - OutNetMessage out = (OutNetMessage)_out.get(i); + List outBuf = null; + synchronized (_out) { outBuf = new ArrayList(_out); } + for (int i = 0; i < outBuf.size(); i++) { + OutNetMessage out = (OutNetMessage)outBuf.get(i); getContext().messageRegistry().unregisterPending(out); } int timeRemaining = (int)(_origExpiration - getContext().clock().now()); diff --git a/router/java/src/net/i2p/router/transport/OutboundMessageRegistry.java b/router/java/src/net/i2p/router/transport/OutboundMessageRegistry.java index ed857c1a1..ce9673e61 100644 --- a/router/java/src/net/i2p/router/transport/OutboundMessageRegistry.java +++ b/router/java/src/net/i2p/router/transport/OutboundMessageRegistry.java @@ -171,6 +171,7 @@ public class OutboundMessageRegistry { } public void unregisterPending(OutNetMessage msg) { + if (msg == null) return; MessageSelector sel = msg.getReplySelector(); boolean stillActive = false; synchronized (_selectorToMessage) { diff --git a/router/java/src/net/i2p/router/transport/ntcp/EstablishState.java b/router/java/src/net/i2p/router/transport/ntcp/EstablishState.java index 373803ed6..162c9ddf6 100644 --- a/router/java/src/net/i2p/router/transport/ntcp/EstablishState.java +++ b/router/java/src/net/i2p/router/transport/ntcp/EstablishState.java @@ -318,6 +318,8 @@ public class EstablishState { } } } + if (_e_hXY_tsB == null) return; // !src.hasRemaining + while (_received < _Y.length + _e_hXY_tsB.length && src.hasRemaining()) { int i = _received-_Y.length; _received++; @@ -883,4 +885,4 @@ public class EstablishState { e.printStackTrace(); } } -} \ No newline at end of file +} diff --git a/router/java/src/net/i2p/router/tunnel/BatchedPreprocessor.java b/router/java/src/net/i2p/router/tunnel/BatchedPreprocessor.java index 01288a2a8..8aa6ec349 100644 --- a/router/java/src/net/i2p/router/tunnel/BatchedPreprocessor.java +++ b/router/java/src/net/i2p/router/tunnel/BatchedPreprocessor.java @@ -296,7 +296,13 @@ public class BatchedPreprocessor extends TrivialPreprocessor { return; } - preprocess(preprocessed, offset); + try { + preprocess(preprocessed, offset); + } catch (ArrayIndexOutOfBoundsException aioobe) { + if (_log.shouldLog(Log.ERROR)) + _log.error("Error preprocessing the messages (offset=" + offset + " start=" + startAt + " through=" + sendThrough + " pending=" + pending.size() + " preproc=" + preprocessed.length); + return; + } long msgId = sender.sendPreprocessed(preprocessed, rec); for (int i = 0; i < pending.size(); i++) {