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:
@ -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),
|
||||
|
@ -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) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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());
|
||||
|
@ -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) {
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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++) {
|
||||
|
Reference in New Issue
Block a user