From 9ae589449d0ce9f56900cd090c6bed4ff592e96b Mon Sep 17 00:00:00 2001 From: zzz Date: Sun, 16 Nov 2008 19:12:58 +0000 Subject: [PATCH 01/11] tweak --- router/java/src/net/i2p/router/tunnel/pool/BuildHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/router/java/src/net/i2p/router/tunnel/pool/BuildHandler.java b/router/java/src/net/i2p/router/tunnel/pool/BuildHandler.java index 10835207e..c5121e7c8 100644 --- a/router/java/src/net/i2p/router/tunnel/pool/BuildHandler.java +++ b/router/java/src/net/i2p/router/tunnel/pool/BuildHandler.java @@ -499,7 +499,7 @@ class BuildHandler { } if (response == 0 && (isInGW || isOutEnd) && - Boolean.valueOf(_context.getProperty(PROP_REJECT_NONPARTICIPANT))) { + Boolean.valueOf(_context.getProperty(PROP_REJECT_NONPARTICIPANT)).booleanValue()) { response = TunnelHistory.TUNNEL_REJECT_BANDWIDTH; } From da9a4ce55780a589793f95fab4ecc54193c9b438 Mon Sep 17 00:00:00 2001 From: zzz Date: Thu, 20 Nov 2008 14:14:13 +0000 Subject: [PATCH 02/11] EepGet: - Better handling of 504 gateway timeout (keep going up to limit of retry count rather than just one more partial fetch) - Add -t cmd line option for timeout - Better handling of 403, 409, 503 errors - Don't keep going after unknown return code - Don't delay before exiting after a failure --- core/java/src/net/i2p/util/EepGet.java | 22 ++++++++++++++++------ history.txt | 14 ++++++++++++++ 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/core/java/src/net/i2p/util/EepGet.java b/core/java/src/net/i2p/util/EepGet.java index 468fefa79..4abdc6fd4 100644 --- a/core/java/src/net/i2p/util/EepGet.java +++ b/core/java/src/net/i2p/util/EepGet.java @@ -132,6 +132,7 @@ public class EepGet { int numRetries = 5; int markSize = 1024; int lineLen = 40; + int inactivityTimeout = 60*1000; String etag = null; String saveAs = null; String url = null; @@ -145,6 +146,9 @@ public class EepGet { } else if (args[i].equals("-n")) { numRetries = Integer.parseInt(args[i+1]); i++; + } else if (args[i].equals("-t")) { + inactivityTimeout = 1000 * Integer.parseInt(args[i+1]); + i++; } else if (args[i].equals("-e")) { etag = "\"" + args[i+1] + "\""; i++; @@ -174,7 +178,7 @@ public class EepGet { EepGet get = new EepGet(I2PAppContext.getGlobalContext(), true, proxyHost, proxyPort, numRetries, saveAs, url, true, etag); get.addStatusListener(get.new CLIStatusListener(markSize, lineLen)); - get.fetch(); + get.fetch(45*1000, -1, inactivityTimeout); } public static String suggestName(String url) { @@ -208,7 +212,7 @@ public class EepGet { } private static void usage() { - System.err.println("EepGet [-p localhost:4444] [-n #retries] [-o outputFile] [-m markSize lineLen] url"); + System.err.println("EepGet [-p localhost:4444] [-n #retries] [-o outputFile] [-m markSize lineLen] [-t timeout] url"); } public static interface StatusListener { @@ -416,7 +420,7 @@ public class EepGet { SocketTimeout timeout = null; if (_fetchHeaderTimeout > 0) timeout = new SocketTimeout(_fetchHeaderTimeout); - final SocketTimeout stimeout = timeout; // ugly + final SocketTimeout stimeout = timeout; // ugly - why not use sotimeout? timeout.setTimeoutCommand(new Runnable() { public void run() { if (_log.shouldLog(Log.DEBUG)) @@ -457,7 +461,7 @@ public class EepGet { } _currentAttempt++; - if (_currentAttempt > _numRetries) + if (_currentAttempt > _numRetries || !_keepFetching) break; try { long delay = _context.random().nextInt(60*1000); @@ -629,8 +633,6 @@ public class EepGet { if (_log.shouldLog(Log.DEBUG)) _log.debug("rc: " + responseCode + " for " + _actualURL); - if(_transferFailed) - _log.error("Already failed for " + _actualURL); boolean rcOk = false; switch (responseCode) { case 200: // full @@ -661,16 +663,24 @@ public class EepGet { _keepFetching = false; _notModified = true; return; + case 403: // bad req case 404: // not found + case 409: // bad addr helper + case 503: // no outproxy _keepFetching = false; _transferFailed = true; + // maybe we should throw instead of return to get the return code back to the user return; case 416: // completed (or range out of reach) _bytesRemaining = 0; _keepFetching = false; return; + case 504: // gateway timeout + // throw out of doFetch() to fetch() and try again + throw new IOException("HTTP Proxy timeout"); default: rcOk = false; + _keepFetching = false; _transferFailed = true; } diff --git a/history.txt b/history.txt index 6b75c82c1..a14eea390 100644 --- a/history.txt +++ b/history.txt @@ -1,3 +1,17 @@ +2008-11-20 zzz + * I2PTunnel: Handle missing fields in edit pages better + * Move DummyNetworkDatabaseFacade to his own file + to help the build dependencies + * Drop old tcp transport and old tunnel build sources + * EepGet: + - Better handling of 504 gateway timeout + (keep going up to limit of retry count rather + than just one more partial fetch) + - Add -t cmd line option for timeout + - Better handling of 403, 409, 503 errors + - Don't keep going after unknown return code + - Don't delay before exiting after a failure + 2008-11-15 zzz * Build files: - Don't die if depend not available From 4e5825c648213d3f971f8d8b3d5442231ac2e118 Mon Sep 17 00:00:00 2001 From: zzz Date: Fri, 21 Nov 2008 16:29:16 +0000 Subject: [PATCH 03/11] * Cache DNS and negative DNS for 5m (was 1m and forever) * Delay shitlist cleaner at startup * Strip wrapper properties from client config * Define multiple cert type * Prohibit negative maxSends in streaming * HTML fixup on configtunnels.jsp * Increase wrapper exit timeout from default 15s to 30s --- .../i2p/router/web/ConfigTunnelsHelper.java | 16 +++++++-------- .../streaming/ConnectionDataReceiver.java | 7 ++++++- .../client/streaming/ConnectionOptions.java | 9 +++++---- .../src/net/i2p/client/streaming/Packet.java | 2 +- .../src/net/i2p/client/I2PSessionImpl.java | 20 ++++++++----------- core/java/src/net/i2p/data/Certificate.java | 2 ++ history.txt | 9 +++++++++ installer/resources/wrapper.config | 6 ++++++ router/java/src/net/i2p/router/Router.java | 9 ++++++--- router/java/src/net/i2p/router/Shitlist.java | 2 ++ 10 files changed, 53 insertions(+), 29 deletions(-) diff --git a/apps/routerconsole/java/src/net/i2p/router/web/ConfigTunnelsHelper.java b/apps/routerconsole/java/src/net/i2p/router/web/ConfigTunnelsHelper.java index 6e9c4691b..fe17164d3 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/ConfigTunnelsHelper.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/ConfigTunnelsHelper.java @@ -90,14 +90,14 @@ public class ConfigTunnelsHelper { renderOptions(buf, 0, MAX_LENGTH, now, "", "hop"); if (now > MAX_LENGTH) renderOptions(buf, now, now, now, "", "hop"); - buf.append("\n"); + buf.append("\n"); buf.append("\n"); buf.append("\n"); // tunnel depth variance @@ -111,7 +111,7 @@ public class ConfigTunnelsHelper { renderOptions(buf, now, now, now, "+ 0-", "hop"); else if (now < MIN_NEG_VARIANCE) renderOptions(buf, now, now, now, "+/- 0", "hop"); - buf.append("\n"); + buf.append("\n"); buf.append("\n"); // tunnel quantity buf.append("Quantity\n"); @@ -131,14 +131,14 @@ public class ConfigTunnelsHelper { renderOptions(buf, 1, MAX_QUANTITY, now, "", "tunnel"); if (now > MAX_QUANTITY) renderOptions(buf, now, now, now, "", "tunnel"); - buf.append("\n"); + buf.append("\n"); buf.append("\n"); buf.append("\n"); // tunnel backup quantity @@ -148,14 +148,14 @@ public class ConfigTunnelsHelper { renderOptions(buf, 0, MAX_QUANTITY, now, "", "tunnel"); if (now > MAX_QUANTITY) renderOptions(buf, now, now, now, "", "tunnel"); - buf.append("\n"); + buf.append("\n"); buf.append("\n"); buf.append("\n"); // custom options diff --git a/apps/streaming/java/src/net/i2p/client/streaming/ConnectionDataReceiver.java b/apps/streaming/java/src/net/i2p/client/streaming/ConnectionDataReceiver.java index 8ca0e982c..281203d91 100644 --- a/apps/streaming/java/src/net/i2p/client/streaming/ConnectionDataReceiver.java +++ b/apps/streaming/java/src/net/i2p/client/streaming/ConnectionDataReceiver.java @@ -28,11 +28,16 @@ class ConnectionDataReceiver implements MessageOutputStream.DataReceiver { /** * This tells the flusher in MessageOutputStream whether to flush. * It won't flush if this returns true. - * It was: return con.getUnackedPacketsSent() > 0; + * + * It was: return con.getUnackedPacketsSent() > 0 (i.e. Nagle) * But then, for data that fills more than one packet, the last part of * the data isn't sent until all the previous packets are acked. Which is very slow. + * The poor interaction of Nagle and Delayed Acknowledgements is well-documented. * * So let's send data along unless the outbound window is full. + * (i.e. no-Nagle or TCP_NODELAY) + * + * Probably should have a configuration option for this. * * @return !flush */ diff --git a/apps/streaming/java/src/net/i2p/client/streaming/ConnectionOptions.java b/apps/streaming/java/src/net/i2p/client/streaming/ConnectionOptions.java index 07915a51e..3cc159f98 100644 --- a/apps/streaming/java/src/net/i2p/client/streaming/ConnectionOptions.java +++ b/apps/streaming/java/src/net/i2p/client/streaming/ConnectionOptions.java @@ -56,7 +56,7 @@ public class ConnectionOptions extends I2PSocketOptionsImpl { private static final int TREND_COUNT = 3; static final int INITIAL_WINDOW_SIZE = 12; static final int DEFAULT_MAX_SENDS = 8; - + public static final int DEFAULT_INITIAL_RTT = 10*1000; static final int MIN_WINDOW_SIZE = 1; /** @@ -208,7 +208,7 @@ public class ConnectionOptions extends I2PSocketOptionsImpl { setConnectDelay(getInt(opts, PROP_CONNECT_DELAY, -1)); setProfile(getInt(opts, PROP_PROFILE, PROFILE_BULK)); setMaxMessageSize(getInt(opts, PROP_MAX_MESSAGE_SIZE, DEFAULT_MAX_MESSAGE_SIZE)); - setRTT(getInt(opts, PROP_INITIAL_RTT, 10*1000)); + setRTT(getInt(opts, PROP_INITIAL_RTT, DEFAULT_INITIAL_RTT)); setReceiveWindow(getInt(opts, PROP_INITIAL_RECEIVE_WINDOW, 1)); setResendDelay(getInt(opts, PROP_INITIAL_RESEND_DELAY, 1000)); setSendAckDelay(getInt(opts, PROP_INITIAL_ACK_DELAY, 2000)); @@ -237,7 +237,7 @@ public class ConnectionOptions extends I2PSocketOptionsImpl { if (opts.containsKey(PROP_MAX_MESSAGE_SIZE)) setMaxMessageSize(getInt(opts, PROP_MAX_MESSAGE_SIZE, Packet.MAX_PAYLOAD_SIZE)); if (opts.containsKey(PROP_INITIAL_RTT)) - setRTT(getInt(opts, PROP_INITIAL_RTT, 10*1000)); + setRTT(getInt(opts, PROP_INITIAL_RTT, DEFAULT_INITIAL_RTT)); if (opts.containsKey(PROP_INITIAL_RECEIVE_WINDOW)) setReceiveWindow(getInt(opts, PROP_INITIAL_RECEIVE_WINDOW, 1)); if (opts.containsKey(PROP_INITIAL_RESEND_DELAY)) @@ -306,6 +306,7 @@ public class ConnectionOptions extends I2PSocketOptionsImpl { } /** after how many consecutive messages should we ack? + * This doesn't appear to be used. * @return receive window size. */ public int getReceiveWindow() { return _receiveWindow; } @@ -420,7 +421,7 @@ public class ConnectionOptions extends I2PSocketOptionsImpl { * @return Maximum retrys before failing a sent message. */ public int getMaxResends() { return _maxResends; } - public void setMaxResends(int numSends) { _maxResends = numSends; } + public void setMaxResends(int numSends) { _maxResends = Math.max(numSends, 0); } /** * What period of inactivity qualifies as "too long"? diff --git a/apps/streaming/java/src/net/i2p/client/streaming/Packet.java b/apps/streaming/java/src/net/i2p/client/streaming/Packet.java index 32c33fdb0..61a7de96d 100644 --- a/apps/streaming/java/src/net/i2p/client/streaming/Packet.java +++ b/apps/streaming/java/src/net/i2p/client/streaming/Packet.java @@ -38,7 +38,7 @@ import net.i2p.util.Log; *
  • {@link #FLAG_SIGNATURE_INCLUDED}: {@link net.i2p.data.Signature}
  • *
  • {@link #FLAG_SIGNATURE_REQUESTED}: no option data
  • *
  • {@link #FLAG_FROM_INCLUDED}: {@link net.i2p.data.Destination}
  • - *
  • {@link #FLAG_DELAY_REQUESTED}: 1 byte integer
  • + *
  • {@link #FLAG_DELAY_REQUESTED}: 2 byte integer
  • *
  • {@link #FLAG_MAX_PACKET_SIZE_INCLUDED}: 2 byte integer
  • *
  • {@link #FLAG_PROFILE_INTERACTIVE}: no option data
  • * diff --git a/core/java/src/net/i2p/client/I2PSessionImpl.java b/core/java/src/net/i2p/client/I2PSessionImpl.java index 69f6c99cc..6b62513c5 100644 --- a/core/java/src/net/i2p/client/I2PSessionImpl.java +++ b/core/java/src/net/i2p/client/I2PSessionImpl.java @@ -171,18 +171,14 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa for (Iterator iter = options.keySet().iterator(); iter.hasNext();) { String key = (String) iter.next(); String val = options.getProperty(key); - if (key.startsWith("java")) { - if (_log.shouldLog(Log.DEBUG)) _log.debug("Skipping java.* property: " + key); - } else if (key.startsWith("user")) { - if (_log.shouldLog(Log.DEBUG)) _log.debug("Skipping user.* property: " + key); - } else if (key.startsWith("os")) { - if (_log.shouldLog(Log.DEBUG)) _log.debug("Skipping os.* property: " + key); - } else if (key.startsWith("sun")) { - if (_log.shouldLog(Log.DEBUG)) _log.debug("Skipping sun.* property: " + key); - } else if (key.startsWith("file")) { - if (_log.shouldLog(Log.DEBUG)) _log.debug("Skipping file.* property: " + key); - } else if (key.startsWith("line")) { - if (_log.shouldLog(Log.DEBUG)) _log.debug("Skipping line.* property: " + key); + if (key.startsWith("java") || + key.startsWith("user") || + key.startsWith("os") || + key.startsWith("sun") || + key.startsWith("file") || + key.startsWith("line") || + key.startsWith("wrapper")) { + if (_log.shouldLog(Log.DEBUG)) _log.debug("Skipping property: " + key); } else if ((key.length() > 255) || (val.length() > 255)) { if (_log.shouldLog(Log.WARN)) _log.warn(getPrefix() + "Not passing on property [" diff --git a/core/java/src/net/i2p/data/Certificate.java b/core/java/src/net/i2p/data/Certificate.java index 40a239053..0d89fcdd8 100644 --- a/core/java/src/net/i2p/data/Certificate.java +++ b/core/java/src/net/i2p/data/Certificate.java @@ -39,6 +39,8 @@ public class Certificate extends DataStructureImpl { /** Signed with 40-byte Signature and (optional) 32-byte hash */ public final static int CERTIFICATE_TYPE_SIGNED = 3; public final static int CERTIFICATE_LENGTH_SIGNED_WITH_HASH = Signature.SIGNATURE_BYTES + Hash.HASH_LENGTH; + /** Contains multiple certs */ + public final static int CERTIFICATE_TYPE_MULTIPLE = 4; public Certificate() { _type = 0; diff --git a/history.txt b/history.txt index a14eea390..7caf84a83 100644 --- a/history.txt +++ b/history.txt @@ -1,3 +1,12 @@ +2008-11-21 zzz + * Cache DNS and negative DNS for 5m (was 1m and forever) + * Delay shitlist cleaner at startup + * Strip wrapper properties from client config + * Define multiple cert type + * Prohibit negative maxSends in streaming + * HTML fixup on configtunnels.jsp + * Increase wrapper exit timeout from default 15s to 30s + 2008-11-20 zzz * I2PTunnel: Handle missing fields in edit pages better * Move DummyNetworkDatabaseFacade to his own file diff --git a/installer/resources/wrapper.config b/installer/resources/wrapper.config index 86fdce2eb..d546dbeff 100644 --- a/installer/resources/wrapper.config +++ b/installer/resources/wrapper.config @@ -60,6 +60,11 @@ wrapper.java.additional.1=-DloggerFilenameOverride=logs/log-router-@.txt wrapper.java.additional.2=-Dorg.mortbay.http.Version.paranoid=true wrapper.java.additional.3=-Dorg.mortbay.util.FileResource.checkAliases=false wrapper.java.additional.4=-Dorg.mortbay.xml.XmlParser.NotValidating=true +# Uncomment this for better performance. +# If it doesn't work, server mode is not available in your JVM. +# This may not be required if your machine is already "server-class". +# See http://java.sun.com/j2se/1.5.0/docs/guide/vm/server-class.html +#wrapper.java.additional.5=-server # Initial Java Heap Size (in MB) #wrapper.java.initmemory=4 @@ -134,6 +139,7 @@ wrapper.restart.delay=60 wrapper.ping.interval=600 wrapper.ping.timeout=605 +wrapper.jvm_exit.timeout=30 # use the wrapper's internal timer thread. otherwise this would # force a restart of the router during daylight savings time as well diff --git a/router/java/src/net/i2p/router/Router.java b/router/java/src/net/i2p/router/Router.java index c7c61245e..98fb1fccd 100644 --- a/router/java/src/net/i2p/router/Router.java +++ b/router/java/src/net/i2p/router/Router.java @@ -81,12 +81,15 @@ public class Router { public final static String PROP_KEYS_FILENAME = "router.keys.location"; public final static String PROP_KEYS_FILENAME_DEFAULT = "router.keys"; public final static String PROP_SHUTDOWN_IN_PROGRESS = "__shutdownInProgress"; + public final static String DNS_CACHE_TIME = "" + (5*60); static { // grumble about sun's java caching DNS entries *forever* by default - // so lets just keep 'em for a minute - System.setProperty("sun.net.inetaddr.ttl", "60"); - System.setProperty("networkaddress.cache.ttl", "60"); + // so lets just keep 'em for a short time + System.setProperty("sun.net.inetaddr.ttl", DNS_CACHE_TIME); + System.setProperty("sun.net.inetaddr.negative.ttl", DNS_CACHE_TIME); + System.setProperty("networkaddress.cache.ttl", DNS_CACHE_TIME); + System.setProperty("networkaddress.cache.negative.ttl", DNS_CACHE_TIME); // until we handle restricted routes and/or all peers support v6, try v4 first System.setProperty("java.net.preferIPv4Stack", "true"); System.setProperty("http.agent", "I2P"); diff --git a/router/java/src/net/i2p/router/Shitlist.java b/router/java/src/net/i2p/router/Shitlist.java index b1d3629e7..5868a15b4 100644 --- a/router/java/src/net/i2p/router/Shitlist.java +++ b/router/java/src/net/i2p/router/Shitlist.java @@ -49,6 +49,7 @@ public class Shitlist { public final static long SHITLIST_DURATION_MAX = 60*60*1000; public final static long SHITLIST_DURATION_PARTIAL = 20*60*1000; public final static long SHITLIST_DURATION_FOREVER = 181l*24*60*60*1000; // will get rounded down to 180d on console + public final static long SHITLIST_CLEANER_START_DELAY = SHITLIST_DURATION_PARTIAL; public Shitlist(RouterContext context) { _context = context; @@ -62,6 +63,7 @@ public class Shitlist { public Cleanup(RouterContext ctx) { super(ctx); _toUnshitlist = new ArrayList(4); + getTiming().setStartAfter(_context.clock().now() + SHITLIST_CLEANER_START_DELAY); } public String getName() { return "Cleanup shitlist"; } public void runJob() { From c8970c0fc685caa7f29caf2509e739349f092ba1 Mon Sep 17 00:00:00 2001 From: dev Date: Wed, 26 Nov 2008 15:20:00 +0000 Subject: [PATCH 04/11] changed some of the URL's --- installer/resources/install_i2p_service_unix | 2 +- installer/resources/osid | 2 +- installer/resources/postinstall.bat | 2 +- installer/resources/postinstall.sh | 2 +- installer/resources/uninstall_i2p_service_unix | 2 +- news.xml | 9 --------- 6 files changed, 5 insertions(+), 14 deletions(-) diff --git a/installer/resources/install_i2p_service_unix b/installer/resources/install_i2p_service_unix index 1da3a8991..bfb6d6018 100644 --- a/installer/resources/install_i2p_service_unix +++ b/installer/resources/install_i2p_service_unix @@ -4,7 +4,7 @@ # # install_i2p_service_unix # 2004 The I2P Project -# http://www.i2p.net +# http://www.i2p2.de/ # This code is public domain. # # author: hypercubus diff --git a/installer/resources/osid b/installer/resources/osid index cc2391849..4b5630b57 100644 --- a/installer/resources/osid +++ b/installer/resources/osid @@ -4,7 +4,7 @@ # # osid # 2004 The I2P Project -# http://www.i2p.net +# http://www.i2p2.de/ # This code is public domain. # # author: hypercubus diff --git a/installer/resources/postinstall.bat b/installer/resources/postinstall.bat index 25d48ccc6..417b02d7c 100644 --- a/installer/resources/postinstall.bat +++ b/installer/resources/postinstall.bat @@ -2,7 +2,7 @@ :: :: postinstall.bat :: 2004 The I2P Project -:: http://www.i2p.net +:: http://www.i2p2.de/ :: This code is public domain. :: :: author: hypercubus diff --git a/installer/resources/postinstall.sh b/installer/resources/postinstall.sh index ffc79ba32..900e1d72a 100644 --- a/installer/resources/postinstall.sh +++ b/installer/resources/postinstall.sh @@ -4,7 +4,7 @@ # # postinstall # 2004 The I2P Project -# http://www.i2p.net +# http://www.i2p2.de/ # This code is public domain. # # author: hypercubus diff --git a/installer/resources/uninstall_i2p_service_unix b/installer/resources/uninstall_i2p_service_unix index bed91169d..8a93bc8cd 100644 --- a/installer/resources/uninstall_i2p_service_unix +++ b/installer/resources/uninstall_i2p_service_unix @@ -4,7 +4,7 @@ # # uninstall_i2p_service_unix # 2004 The I2P Project -# http://www.i2p.net +# http://www.i2p2.de/ # This code is public domain. # # author: hypercubus diff --git a/news.xml b/news.xml index a34bf7350..f368dac7c 100644 --- a/news.xml +++ b/news.xml @@ -27,13 +27,4 @@ router throttling, collection of tunnel pool statistics, as well as router console and I2PSnark improvements (and texts to explain reachability issues) are also included.

    - - From 41d98acc958c88d71e3d164a22356f689c1f97a6 Mon Sep 17 00:00:00 2001 From: dev Date: Wed, 26 Nov 2008 15:56:36 +0000 Subject: [PATCH 05/11] minor style changes --- core/java/src/net/i2p/I2PAppContext.java | 73 ++++++++++++++++++------ core/java/src/net/i2p/client/ATalk.java | 24 ++++++-- 2 files changed, 74 insertions(+), 23 deletions(-) diff --git a/core/java/src/net/i2p/I2PAppContext.java b/core/java/src/net/i2p/I2PAppContext.java index 403acf44b..cac8cdb29 100644 --- a/core/java/src/net/i2p/I2PAppContext.java +++ b/core/java/src/net/i2p/I2PAppContext.java @@ -91,7 +91,8 @@ public class I2PAppContext { private volatile boolean _routingKeyGeneratorInitialized; private volatile boolean _randomInitialized; private volatile boolean _keyGeneratorInitialized; - + + /** * Pull the default context, creating a new one if necessary, else using * the first one created. @@ -105,7 +106,7 @@ public class I2PAppContext { } return _globalAppContext; } - + /** * Lets root a brand new context * @@ -113,6 +114,7 @@ public class I2PAppContext { public I2PAppContext() { this(true, null); } + /** * Lets root a brand new context * @@ -120,6 +122,7 @@ public class I2PAppContext { public I2PAppContext(Properties envProps) { this(true, envProps); } + /** * @param doInit should this context be used as the global one (if necessary)? */ @@ -175,6 +178,7 @@ public class I2PAppContext { } return System.getProperty(propName, defaultValue); } + /** * Access the configuration attributes of this context, listing the properties * provided during the context construction, as well as the ones included in @@ -194,9 +198,11 @@ public class I2PAppContext { * over time. */ public StatManager statManager() { - if (!_statManagerInitialized) initializeStatManager(); + if (!_statManagerInitialized) + initializeStatManager(); return _statManager; } + private void initializeStatManager() { synchronized (this) { if (_statManager == null) @@ -215,9 +221,11 @@ public class I2PAppContext { * */ public SessionKeyManager sessionKeyManager() { - if (!_sessionKeyManagerInitialized) initializeSessionKeyManager(); + if (!_sessionKeyManagerInitialized) + initializeSessionKeyManager(); return _sessionKeyManager; } + private void initializeSessionKeyManager() { synchronized (this) { if (_sessionKeyManager == null) @@ -232,9 +240,11 @@ public class I2PAppContext { * specified to customize the naming service exposed. */ public NamingService namingService() { - if (!_namingServiceInitialized) initializeNamingService(); + if (!_namingServiceInitialized) + initializeNamingService(); return _namingService; } + private void initializeNamingService() { synchronized (this) { if (_namingService == null) { @@ -245,9 +255,11 @@ public class I2PAppContext { } public PetNameDB petnameDb() { - if (!_petnameDbInitialized) initializePetnameDb(); + if (!_petnameDbInitialized) + initializePetnameDb(); return _petnameDb; } + private void initializePetnameDb() { synchronized (this) { if (_petnameDb == null) { @@ -266,9 +278,11 @@ public class I2PAppContext { * it ;) */ public ElGamalEngine elGamalEngine() { - if (!_elGamalEngineInitialized) initializeElGamalEngine(); + if (!_elGamalEngineInitialized) + initializeElGamalEngine(); return _elGamalEngine; } + private void initializeElGamalEngine() { synchronized (this) { if (_elGamalEngine == null) { @@ -289,9 +303,11 @@ public class I2PAppContext { * */ public ElGamalAESEngine elGamalAESEngine() { - if (!_elGamalAESEngineInitialized) initializeElGamalAESEngine(); + if (!_elGamalAESEngineInitialized) + initializeElGamalAESEngine(); return _elGamalAESEngine; } + private void initializeElGamalAESEngine() { synchronized (this) { if (_elGamalAESEngine == null) @@ -307,9 +323,11 @@ public class I2PAppContext { * disable it. */ public AESEngine aes() { - if (!_AESEngineInitialized) initializeAESEngine(); + if (!_AESEngineInitialized) + initializeAESEngine(); return _AESEngine; } + private void initializeAESEngine() { synchronized (this) { if (_AESEngine == null) { @@ -329,9 +347,11 @@ public class I2PAppContext { * their own log levels, output locations, and rotation configuration. */ public LogManager logManager() { - if (!_logManagerInitialized) initializeLogManager(); + if (!_logManagerInitialized) + initializeLogManager(); return _logManager; } + private void initializeLogManager() { synchronized (this) { if (_logManager == null) @@ -339,15 +359,18 @@ public class I2PAppContext { _logManagerInitialized = true; } } + /** * There is absolutely no good reason to make this context specific, * other than for consistency, and perhaps later we'll want to * include some stats. */ public HMACGenerator hmac() { - if (!_hmacInitialized) initializeHMAC(); + if (!_hmacInitialized) + initializeHMAC(); return _hmac; } + private void initializeHMAC() { synchronized (this) { if (_hmac == null) { @@ -358,9 +381,11 @@ public class I2PAppContext { } public HMAC256Generator hmac256() { - if (!_hmac256Initialized) initializeHMAC256(); + if (!_hmac256Initialized) + initializeHMAC256(); return _hmac256; } + private void initializeHMAC256() { synchronized (this) { if (_hmac256 == null) { @@ -375,9 +400,11 @@ public class I2PAppContext { * */ public SHA256Generator sha() { - if (!_shaInitialized) initializeSHA(); + if (!_shaInitialized) + initializeSHA(); return _sha; } + private void initializeSHA() { synchronized (this) { if (_sha == null) @@ -391,9 +418,11 @@ public class I2PAppContext { * */ public DSAEngine dsa() { - if (!_dsaInitialized) initializeDSA(); + if (!_dsaInitialized) + initializeDSA(); return _dsa; } + private void initializeDSA() { synchronized (this) { if (_dsa == null) { @@ -411,9 +440,11 @@ public class I2PAppContext { * the appContext, see the DSA, HMAC, and SHA comments above. */ public KeyGenerator keyGenerator() { - if (!_keyGeneratorInitialized) initializeKeyGenerator(); + if (!_keyGeneratorInitialized) + initializeKeyGenerator(); return _keyGenerator; } + private void initializeKeyGenerator() { synchronized (this) { if (_keyGenerator == null) @@ -428,9 +459,11 @@ public class I2PAppContext { * */ public Clock clock() { // overridden in RouterContext - if (!_clockInitialized) initializeClock(); + if (!_clockInitialized) + initializeClock(); return _clock; } + protected void initializeClock() { // overridden in RouterContext synchronized (this) { if (_clock == null) @@ -447,9 +480,11 @@ public class I2PAppContext { * */ public RoutingKeyGenerator routingKeyGenerator() { - if (!_routingKeyGeneratorInitialized) initializeRoutingKeyGenerator(); + if (!_routingKeyGeneratorInitialized) + initializeRoutingKeyGenerator(); return _routingKeyGenerator; } + private void initializeRoutingKeyGenerator() { synchronized (this) { if (_routingKeyGenerator == null) @@ -463,9 +498,11 @@ public class I2PAppContext { * */ public RandomSource random() { - if (!_randomInitialized) initializeRandom(); + if (!_randomInitialized) + initializeRandom(); return _random; } + private void initializeRandom() { synchronized (this) { if (_random == null) { diff --git a/core/java/src/net/i2p/client/ATalk.java b/core/java/src/net/i2p/client/ATalk.java index a517e995c..7493f73d5 100644 --- a/core/java/src/net/i2p/client/ATalk.java +++ b/core/java/src/net/i2p/client/ATalk.java @@ -41,24 +41,34 @@ import net.i2p.util.Log; public class ATalk implements I2PSessionListener, Runnable { /** logging hook - status messages are piped to this */ private final static Log _log = new Log(ATalk.class); + /** platform independent newline */ private final static String NL = System.getProperty("line.separator"); + /** the current session */ private I2PSession _session; + /** who am i */ private Destination _myDestination; + /** who are you? */ private Destination _peerDestination; + /** location of my secret key file */ private String _myKeyFile; + /** location of their public key */ private String _theirDestinationFile; + /** where the application reads input from. currently set to standard input */ private BufferedReader _in; + /** where the application sends output to. currently set to standard output */ private BufferedWriter _out; + /** string that messages must begin with to be treated as files */ private final static String FILE_COMMAND = ".file: "; + /** the, erm, manual */ private final static String MANUAL = "ATalk: Anonymous Talk, a demo program for the Invisible Internet Project SDK" + NL @@ -84,7 +94,9 @@ public class ATalk implements I2PSessionListener, Runnable { + NL + "To end the talk session, enter a period on a line by itself and hit return" + NL; + public final static String PROP_CONFIG_LOCATION = "configFile"; + private static final SimpleDateFormat _fmt = new SimpleDateFormat("hh:mm:ss.SSS"); /** Construct the talk engine, but don't connect yet */ @@ -111,11 +123,12 @@ public class ATalk implements I2PSessionListener, Runnable { _log.warn("Unable to load up the ATalk config file " + configLocation); } // Provide any router or client API configuration here. - if (!props.containsKey(I2PClient.PROP_TCP_HOST)) props.setProperty(I2PClient.PROP_TCP_HOST, "localhost"); - if (!props.containsKey(I2PClient.PROP_TCP_PORT)) props.setProperty(I2PClient.PROP_TCP_PORT, "7654"); + if (!props.containsKey(I2PClient.PROP_TCP_HOST)) + props.setProperty(I2PClient.PROP_TCP_HOST, "localhost"); + if (!props.containsKey(I2PClient.PROP_TCP_PORT)) + props.setProperty(I2PClient.PROP_TCP_PORT, "7654"); if (!props.containsKey(I2PClient.PROP_RELIABILITY)) - props.setProperty(I2PClient.PROP_RELIABILITY, - I2PClient.PROP_RELIABILITY_BEST_EFFORT); + props.setProperty(I2PClient.PROP_RELIABILITY, I2PClient.PROP_RELIABILITY_BEST_EFFORT); _session = client.createSession(new FileInputStream(myFile), props); _session.setSessionListener(this); _session.connect(); @@ -364,4 +377,5 @@ public class ATalk implements I2PSessionListener, Runnable { public void reportAbuse(I2PSession session, int severity) { _log.debug("Abuse reported of severity " + severity); } -} \ No newline at end of file +} + From daac598bdea6604bafae59cb2acd2d46239a7d3f Mon Sep 17 00:00:00 2001 From: zzz Date: Wed, 26 Nov 2008 18:32:51 +0000 Subject: [PATCH 06/11] fix windows url launcher --- apps/systray/java/src/net/i2p/apps/systray/UrlLauncher.java | 6 +++++- build.xml | 2 ++ history.txt | 3 +++ installer/resources/clients.config | 2 +- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/apps/systray/java/src/net/i2p/apps/systray/UrlLauncher.java b/apps/systray/java/src/net/i2p/apps/systray/UrlLauncher.java index 7ccc5e2a2..5487f5faf 100644 --- a/apps/systray/java/src/net/i2p/apps/systray/UrlLauncher.java +++ b/apps/systray/java/src/net/i2p/apps/systray/UrlLauncher.java @@ -74,7 +74,11 @@ public class UrlLauncher { bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream("browser.reg"), "UTF-16")); for (String line; (line = bufferedReader.readLine()) != null; ) { if (line.startsWith("@=")) { - browserString = "\"" + line.substring(3, line.toLowerCase().indexOf(".exe") + 4) + "\""; + // we should really use the whole line and replace %1 with the url + browserString = line.substring(3, line.toLowerCase().indexOf(".exe") + 4); + if (browserString.startsWith("\\\"")) + browserString = browserString.substring(2); + browserString = "\"" + browserString + "\""; } } try { diff --git a/build.xml b/build.xml index 4410a8aa1..f7e7030cb 100644 --- a/build.xml +++ b/build.xml @@ -332,6 +332,8 @@ + + diff --git a/history.txt b/history.txt index 7caf84a83..fee2dcf0d 100644 --- a/history.txt +++ b/history.txt @@ -1,3 +1,6 @@ +2008-11-26 zzz + * Fix Windows UrlLauncher + 2008-11-21 zzz * Cache DNS and negative DNS for 5m (was 1m and forever) * Delay shitlist cleaner at startup diff --git a/installer/resources/clients.config b/installer/resources/clients.config index 62cea2258..5245e3bfc 100644 --- a/installer/resources/clients.config +++ b/installer/resources/clients.config @@ -27,7 +27,7 @@ clientApp.3.startOnLoad=true # load a browser pointing at the web console whenever we start up clientApp.4.main=net.i2p.apps.systray.UrlLauncher clientApp.4.name=consoleBrowser -clientApp.4.args=http://localhost:7657/ +clientApp.4.args=http://localhost:7657/index.jsp clientApp.4.delay=5 clientApp.4.startOnLoad=true From 90983c876112457ebbf3a623472ab85ae1a70281 Mon Sep 17 00:00:00 2001 From: dev Date: Thu, 27 Nov 2008 19:19:24 +0000 Subject: [PATCH 07/11] added inital version of a deploy script --- deploy.xml | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 deploy.xml diff --git a/deploy.xml b/deploy.xml new file mode 100644 index 000000000..9e56af390 --- /dev/null +++ b/deploy.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 6a3c52b7fa1ed07197f94445043822461dc91e3b Mon Sep 17 00:00:00 2001 From: sponge Date: Fri, 28 Nov 2008 16:07:29 +0000 Subject: [PATCH 08/11] Added verify command to check that a destination's BASE64 is correct for external applications that need it. --- apps/BOB/build.xml | 5 ++++ apps/BOB/nbproject/build-impl.xml | 23 +++++++++++++++---- apps/BOB/nbproject/genfiles.properties | 8 +++---- apps/BOB/nbproject/private/private.properties | 4 ++-- apps/BOB/src/net/i2p/BOB/DoCMDS.java | 21 ++++++++++++----- 5 files changed, 44 insertions(+), 17 deletions(-) diff --git a/apps/BOB/build.xml b/apps/BOB/build.xml index f76222aea..0d2a66eaa 100644 --- a/apps/BOB/build.xml +++ b/apps/BOB/build.xml @@ -2,6 +2,11 @@ + + + + + Builds, tests, and runs the project BOB. diff --git a/apps/BOB/nbproject/build-impl.xml b/apps/BOB/nbproject/build-impl.xml index 5dcf75563..9feea8e03 100644 --- a/apps/BOB/nbproject/build-impl.xml +++ b/apps/BOB/nbproject/build-impl.xml @@ -218,13 +218,13 @@ is divided into following sections: - + - + @@ -255,6 +255,12 @@ is divided into following sections: + + + + + + @@ -264,7 +270,7 @@ is divided into following sections: - + @@ -311,6 +317,13 @@ is divided into following sections: =================== --> + + + + + + + @@ -331,7 +344,7 @@ is divided into following sections: - + @@ -345,7 +358,7 @@ is divided into following sections: - +