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
This commit is contained in:
jrandom
2006-09-09 01:41:57 +00:00
committed by zzz
parent 0f56ec8078
commit 0903dc46c6
9 changed files with 64 additions and 19 deletions

View File

@ -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);

View File

@ -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

View File

@ -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),

View File

@ -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) {}
}
}
}
}

View File

@ -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);

View File

@ -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());

View File

@ -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) {

View File

@ -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();
}
}
}
}

View File

@ -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++) {