2004-11-25 jrandom

* Revised the installer to include start menu and desktop shortcuts for
      windows platforms, including pretty icons (thanks DrWoo!)
    * Allow clients specified in clients.config to have an explicit startup
      delay.
    * Update the default install to launch a browser pointing at the console
      whenever I2P starts up, rather than only the first time it starts up
      (configurable on /configservice.jsp, or in clients.config)
    * Bugfix to the clock skew checking code to monitor the delta between
      offsets, not the offset itself (duh)
    * Router console html update
    * New (and uuuuugly) code to verify that the wrapper.config contains
      the necessary classpath entries on update.  If it has to update the
      wrapper.config, it will stop the JVM and service completely, since the
      java service wrapper doesn't reread the wrapper.config on JVM restart -
      requiring the user to manually restart the service after an update.
    * Increase the TCP connection timeout to 30s (which is obscenely long)
------------------------------------------------
This commit is contained in:
jrandom
2004-11-25 21:57:19 +00:00
committed by zzz
parent b0513fff8a
commit 8bd99f699f
37 changed files with 577 additions and 115 deletions

View File

@ -36,6 +36,7 @@ import net.i2p.data.i2np.TunnelMessage;
import net.i2p.router.message.GarlicMessageHandler;
import net.i2p.router.message.TunnelMessageHandler;
import net.i2p.router.startup.StartupJob;
import net.i2p.router.startup.VerifyClasspath;
import net.i2p.stat.Rate;
import net.i2p.stat.RateStat;
import net.i2p.util.FileUtil;
@ -793,6 +794,7 @@ public class Router {
public static void main(String args[]) {
installUpdates();
verifyClasspath();
Router r = new Router();
r.runRouter();
}
@ -818,6 +820,15 @@ public class Router {
}
}
private static void verifyClasspath() {
boolean updated = VerifyClasspath.updateClasspath();
if (updated) {
System.out.println("INFO: Classpath updated, but the service wrapper requires you to manually restart");
System.out.println("INFO: Shutting down the router - please rerun it!");
System.exit(EXIT_HARD);
}
}
private static String getPingFile(Properties envProps) {
if (envProps != null)
return envProps.getProperty("router.pingFile", "router.ping");

View File

@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
*
*/
public class RouterVersion {
public final static String ID = "$Revision: 1.85 $ $Date: 2004/11/22 12:57:16 $";
public final static String ID = "$Revision: 1.86 $ $Date: 2004/11/22 20:12:34 $";
public final static String VERSION = "0.4.1.4";
public final static long BUILD = 14;
public final static long BUILD = 15;
public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION);
System.out.println("Router ID: " + RouterVersion.ID);

View File

@ -43,11 +43,16 @@ class LoadClientAppsJob extends JobImpl {
String className = clientApps.getProperty("clientApp."+i+".main");
String clientName = clientApps.getProperty("clientApp."+i+".name");
String args = clientApps.getProperty("clientApp."+i+".args");
String delayStr = clientApps.getProperty("clientApp." + i + ".delay");
String onBoot = clientApps.getProperty("clientApp." + i + ".onBoot");
boolean onStartup = false;
if (onBoot != null)
onStartup = "true".equals(onBoot) || "yes".equals(onBoot);
long delay = (onStartup ? 0 : STARTUP_DELAY);
if (delayStr != null)
try { delay = 1000*Integer.parseInt(delayStr); } catch (NumberFormatException nfe) {}
if (className == null)
break;
@ -56,8 +61,8 @@ class LoadClientAppsJob extends JobImpl {
// run this guy now
runClient(className, clientName, argVal);
} else {
// wait 2 minutes
getContext().jobQueue().addJob(new DelayedRunClient(className, clientName, argVal));
// wait before firing it up
getContext().jobQueue().addJob(new DelayedRunClient(className, clientName, argVal, delay));
}
i++;
}
@ -85,12 +90,12 @@ class LoadClientAppsJob extends JobImpl {
private String _className;
private String _clientName;
private String _args[];
public DelayedRunClient(String className, String clientName, String args[]) {
public DelayedRunClient(String className, String clientName, String args[], long delay) {
super(LoadClientAppsJob.this.getContext());
_className = className;
_clientName = clientName;
_args = args;
getTiming().setStartAfter(LoadClientAppsJob.this.getContext().clock().now() + STARTUP_DELAY);
getTiming().setStartAfter(LoadClientAppsJob.this.getContext().clock().now() + delay);
}
public String getName() { return "Delayed client job"; }
public void runJob() {

View File

@ -0,0 +1,87 @@
package net.i2p.router.startup;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import java.util.Properties;
import net.i2p.data.DataHelper;
/**
* Make sure that if there is a wrapper.config file, it includes
* all of the jar files necessary for the current build.
* HOLY CRAP THIS IS UGLY.
*
*/
public class VerifyClasspath {
private static final String NL = System.getProperty("line.separator");
private static final Set _jars = new HashSet();
static {
_jars.add("lib/ant.jar");
_jars.add("lib/heartbeat.jar");
_jars.add("lib/i2p.jar");
_jars.add("lib/i2ptunnel.jar");
_jars.add("lib/jasper-compiler.jar");
_jars.add("lib/jasper-runtime.jar");
_jars.add("lib/javax.servlet.jar");
_jars.add("lib/jnet.jar");
_jars.add("lib/mstreaming.jar");
_jars.add("lib/netmonitor.jar");
_jars.add("lib/org.mortbay.jetty.jar");
_jars.add("lib/router.jar");
_jars.add("lib/routerconsole.jar");
_jars.add("lib/sam.jar");
_jars.add("lib/wrapper.jar");
_jars.add("lib/xercesImpl.jar");
_jars.add("lib/xml-apis.jar");
_jars.add("lib/jbigi.jar");
_jars.add("lib/systray.jar");
_jars.add("lib/systray4j.jar");
_jars.add("lib/streaming.jar");
}
/**
* update the wrapper.config
*
* @return true if the classpath was updated and a restart is
* required, false otherwise.
*/
public static boolean updateClasspath() {
Properties p = new Properties();
File configFile = new File("wrapper.config");
Set needed = new HashSet(_jars);
try {
DataHelper.loadProps(p, configFile);
Set toAdd = new HashSet();
int entry = 1;
while (true) {
String value = p.getProperty("wrapper.java.classpath." + entry);
if (value == null) break;
needed.remove(value);
entry++;
}
if (needed.size() <= 0) {
// we have everything we need
return false;
} else {
// add on some new lines
FileWriter out = new FileWriter(configFile, true);
out.write(NL + "# Adding new libs as required by the update" + NL);
for (Iterator iter = needed.iterator(); iter.hasNext(); ) {
String name = (String)iter.next();
out.write("wrapper.java.classpath." + entry + "=" + name + NL);
}
out.close();
return true;
}
} catch (IOException ioe) {
ioe.printStackTrace();
return false;
}
}
}

View File

@ -79,8 +79,8 @@ public class ConnectionBuilder {
*/
private String _error;
/** If the connection hasn't been built in 10 seconds, give up */
public static final int CONNECTION_TIMEOUT = 10*1000;
/** If the connection hasn't been built in 30 seconds, give up */
public static final int CONNECTION_TIMEOUT = 30*1000;
public static final int WRITE_BUFFER_SIZE = 2*1024;

View File

@ -50,7 +50,7 @@ class TCPListener {
*/
private final static int MAX_FAIL_DELAY = 5*60*1000;
/** if we're not making progress in 10s, drop 'em */
final static int HANDLE_TIMEOUT = 10*1000;
final static int HANDLE_TIMEOUT = 30*1000;
/** id generator for the connections */
private static volatile int __handlerId = 0;