diff --git a/history.txt b/history.txt index 95cba927c..72adcd0d7 100644 --- a/history.txt +++ b/history.txt @@ -1,3 +1,9 @@ +2011-02-03 zzz + * Console: Add DTG to classpath for old installs + * I2PTunnel: Fix NPE + * RandomSource: Fix seeding from /dev/urandom + * Reseed: Limit time spent downloading from a single source + 2011-02-02 sponge * BOB: Revise lookup code, bump BOB version diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index 87e5bffca..282c18b42 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -18,7 +18,7 @@ public class RouterVersion { /** deprecated */ public final static String ID = "Monotone"; public final static String VERSION = CoreVersion.VERSION; - public final static long BUILD = 1; + public final static long BUILD = 2; /** for example "-test" */ public final static String EXTRA = ""; diff --git a/router/java/src/net/i2p/router/networkdb/reseed/Reseeder.java b/router/java/src/net/i2p/router/networkdb/reseed/Reseeder.java index 53fbc716a..4c4c2ce91 100644 --- a/router/java/src/net/i2p/router/networkdb/reseed/Reseeder.java +++ b/router/java/src/net/i2p/router/networkdb/reseed/Reseeder.java @@ -35,12 +35,18 @@ import net.i2p.util.Translate; */ public class Reseeder { private static ReseedRunner _reseedRunner; - private RouterContext _context; - private Log _log; + private final RouterContext _context; + private final Log _log; // Reject unreasonably big files, because we download into a ByteArrayOutputStream. private static final long MAX_RESEED_RESPONSE_SIZE = 1024 * 1024; + /** limit to spend on a single host, to avoid getting stuck on one that is seriously overloaded */ + private static final int MAX_TIME_PER_HOST = 7 * 60 * 1000; + /** + * NOTE - URLs in both the standard and SSL groups should use the same hostname and path, + * so the reseed process will not download from both. + */ public static final String DEFAULT_SEED_URL = "http://a.netdb.i2p2.de/,http://c.netdb.i2p2.de/," + "http://reseed.i2p-projekt.de/,http://forum.i2p2.de/netdb/,http://www.i2pbote.net/netDb/,http://r31453.ovh.net/static_media/files/netDb/"; @@ -229,6 +235,7 @@ public class Reseeder { **/ private int reseedOne(String seedURL, boolean echoStatus) { try { + final long timeLimit = _context.clock().now() + MAX_TIME_PER_HOST; System.setProperty(PROP_STATUS, _("Reseeding: fetching seed URL.")); System.err.println("Reseeding from " + seedURL); URL dir = new URL(seedURL); @@ -267,7 +274,8 @@ public class Reseeder { int fetched = 0; int errors = 0; // 200 max from one URL - for (Iterator iter = urlList.iterator(); iter.hasNext() && fetched < 200; ) { + for (Iterator iter = urlList.iterator(); + iter.hasNext() && fetched < 200 && _context.clock().now() < timeLimit; ) { try { System.setProperty(PROP_STATUS, _("Reseeding: fetching router info from seed URL ({0} successful, {1} errors).", fetched, errors));