2006-02-19 jrandom
* Moved the current net's reseed URL to a different location than where the old net looks (dev.i2p.net/i2pdb2/ vs .../i2pdb/) * More aggressively expire inbound messages (on receive, not just on send) * Add in a hook for breaking backwards compatibility in the SSU wire protocol directly by including a version as part of the handshake. The version is currently set to 0, however, so the wire protocol from this build is compatible with all earlier SSU implementations. * Increased the number of complete message readers, cutting down substantially on the delay processing inbound messages. * Delete the message history file on startup * Reworked the restart/shutdown display on the console (thanks bd_!)
This commit is contained in:
@ -141,7 +141,7 @@ public class ConfigNetHandler extends FormHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private static final String DEFAULT_SEED_URL = "http://dev.i2p.net/i2pdb/";
|
||||
private static final String DEFAULT_SEED_URL = ReseedHandler.DEFAULT_SEED_URL;
|
||||
/**
|
||||
* Reseed has been requested, so lets go ahead and do it. Fetch all of
|
||||
* the routerInfo-*.dat files from the specified URL (or the default) and
|
||||
|
@ -0,0 +1,75 @@
|
||||
package net.i2p.router.web;
|
||||
|
||||
import net.i2p.data.DataHelper;
|
||||
import net.i2p.router.Router;
|
||||
import net.i2p.router.RouterContext;
|
||||
import net.i2p.router.web.ConfigServiceHandler.UpdateWrapperManagerTask;
|
||||
import net.i2p.router.web.ConfigServiceHandler.UpdateWrapperManagerAndRekeyTask;
|
||||
|
||||
/**
|
||||
* simple helper to control restarts/shutdowns in the left hand nav
|
||||
*
|
||||
*/
|
||||
public class ConfigRestartBean {
|
||||
public static String getNonce() {
|
||||
RouterContext ctx = ContextHelper.getContext(null);
|
||||
String nonce = System.getProperty("console.nonce");
|
||||
if (nonce == null) {
|
||||
nonce = ""+ctx.random().nextLong();
|
||||
System.setProperty("console.nonce", nonce);
|
||||
}
|
||||
return nonce;
|
||||
}
|
||||
public static String renderStatus(String urlBase, String action, String nonce) {
|
||||
RouterContext ctx = ContextHelper.getContext(null);
|
||||
String systemNonce = getNonce();
|
||||
if ( (nonce != null) && (systemNonce.equals(nonce)) && (action != null) ) {
|
||||
if ("shutdownImmediate".equals(action)) {
|
||||
ctx.router().addShutdownTask(new ConfigServiceHandler.UpdateWrapperManagerTask(Router.EXIT_HARD));
|
||||
ctx.router().shutdown(Router.EXIT_HARD); // never returns
|
||||
} else if ("cancelShutdown".equals(action)) {
|
||||
ctx.router().cancelGracefulShutdown();
|
||||
} else if ("restartImmediate".equals(action)) {
|
||||
ctx.router().addShutdownTask(new ConfigServiceHandler.UpdateWrapperManagerTask(Router.EXIT_HARD_RESTART));
|
||||
ctx.router().shutdown(Router.EXIT_HARD_RESTART); // never returns
|
||||
} else if ("restart".equals(action)) {
|
||||
ctx.router().addShutdownTask(new ConfigServiceHandler.UpdateWrapperManagerTask(Router.EXIT_GRACEFUL_RESTART));
|
||||
ctx.router().shutdownGracefully(Router.EXIT_GRACEFUL_RESTART);
|
||||
} else if ("shutdown".equals(action)) {
|
||||
ctx.router().addShutdownTask(new ConfigServiceHandler.UpdateWrapperManagerTask(Router.EXIT_GRACEFUL));
|
||||
ctx.router().shutdownGracefully();
|
||||
}
|
||||
}
|
||||
|
||||
boolean shuttingDown = isShuttingDown(ctx);
|
||||
boolean restarting = isRestarting(ctx);
|
||||
long timeRemaining = ctx.router().getShutdownTimeRemaining();
|
||||
if (shuttingDown) {
|
||||
if (timeRemaining <= 0) {
|
||||
return "<b>Shutdown imminent</b>";
|
||||
} else {
|
||||
return "<b>Shutdown in " + DataHelper.formatDuration(timeRemaining) + "</b><br />"
|
||||
+ "<a href=\"" + urlBase + "?consoleNonce=" + systemNonce + "&action=shutdownImmediate\">Shutdown immediately</a><br />"
|
||||
+ "<a href=\"" + urlBase + "?consoleNonce=" + systemNonce + "&action=cancelShutdown\">Cancel shutdown</a> ";
|
||||
}
|
||||
} else if (restarting) {
|
||||
if (timeRemaining <= 0) {
|
||||
return "<b>Restart imminent</b>";
|
||||
} else {
|
||||
return "<b>Restart in " + DataHelper.formatDuration(timeRemaining) + "</b><br />"
|
||||
+ "<a href=\"" + urlBase + "?consoleNonce=" + systemNonce + "&action=restartImmediate\">Restart immediately</a><br />"
|
||||
+ "<a href=\"" + urlBase + "?consoleNonce=" + systemNonce + "&action=cancelShutdown\">Cancel restart</a> ";
|
||||
}
|
||||
} else {
|
||||
return "<a href=\"" + urlBase + "?consoleNonce=" + systemNonce + "&action=restart\" title=\"Graceful restart\">Restart</a> "
|
||||
+ "<a href=\"" + urlBase + "?consoleNonce=" + systemNonce + "&action=shutdown\" title=\"Graceful shutdown\">Shutdown</a>";
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isShuttingDown(RouterContext ctx) {
|
||||
return Router.EXIT_GRACEFUL == ctx.router().scheduledGracefulExitCode();
|
||||
}
|
||||
private static boolean isRestarting(RouterContext ctx) {
|
||||
return Router.EXIT_GRACEFUL_RESTART == ctx.router().scheduledGracefulExitCode();
|
||||
}
|
||||
}
|
@ -24,6 +24,7 @@ public class NoticeHelper {
|
||||
}
|
||||
|
||||
public String getSystemNotice() {
|
||||
if (true) return ""; // moved to the left hand nav
|
||||
if (_context.router().gracefulShutdownInProgress()) {
|
||||
long remaining = _context.router().getShutdownTimeRemaining();
|
||||
if (remaining > 0)
|
||||
|
@ -17,7 +17,7 @@ import net.i2p.util.I2PThread;
|
||||
|
||||
/**
|
||||
* Handler to deal with reseed requests. This reseed from the URL
|
||||
* http://dev.i2p.net/i2pdb/ unless the java env property "i2p.reseedURL" is
|
||||
* http://dev.i2p.net/i2pdb2/ unless the java env property "i2p.reseedURL" is
|
||||
* set. It always writes to ./netDb/, so don't mess with that.
|
||||
*
|
||||
*/
|
||||
@ -58,7 +58,7 @@ public class ReseedHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private static final String DEFAULT_SEED_URL = "http://dev.i2p.net/i2pdb/";
|
||||
static final String DEFAULT_SEED_URL = "http://dev.i2p.net/i2pdb2/";
|
||||
/**
|
||||
* Reseed has been requested, so lets go ahead and do it. Fetch all of
|
||||
* the routerInfo-*.dat files from the specified URL (or the default) and
|
||||
|
Reference in New Issue
Block a user