Changeset 041e194


Ignore:
Timestamp:
Feb 3, 2011 3:47:47 PM (9 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
b8ab14b
Parents:
ee6730f
Message:
  • Reseed: Limit time spent downloading from a single source
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • history.txt

    ree6730f r041e194  
     12011-02-03 zzz
     2    * Console: Add DTG to classpath for old installs
     3    * I2PTunnel: Fix NPE
     4    * RandomSource: Fix seeding from /dev/urandom
     5    * Reseed: Limit time spent downloading from a single source
     6
    172011-02-02 sponge
    28    * BOB: Revise lookup code, bump BOB version
  • router/java/src/net/i2p/router/RouterVersion.java

    ree6730f r041e194  
    1919    public final static String ID = "Monotone";
    2020    public final static String VERSION = CoreVersion.VERSION;
    21     public final static long BUILD = 1;
     21    public final static long BUILD = 2;
    2222
    2323    /** for example "-test" */
  • router/java/src/net/i2p/router/networkdb/reseed/Reseeder.java

    ree6730f r041e194  
    3636public class Reseeder {
    3737    private static ReseedRunner _reseedRunner;
    38     private RouterContext _context;
    39     private Log _log;
     38    private final RouterContext _context;
     39    private final Log _log;
    4040
    4141    // Reject unreasonably big files, because we download into a ByteArrayOutputStream.
    4242    private static final long MAX_RESEED_RESPONSE_SIZE = 1024 * 1024;
    43 
     43    /** limit to spend on a single host, to avoid getting stuck on one that is seriously overloaded */
     44    private static final int MAX_TIME_PER_HOST = 7 * 60 * 1000;
     45
     46    /**
     47     *  NOTE - URLs in both the standard and SSL groups should use the same hostname and path,
     48     *         so the reseed process will not download from both.
     49     */
    4450    public static final String DEFAULT_SEED_URL =
    4551              "http://a.netdb.i2p2.de/,http://c.netdb.i2p2.de/," +
     
    230236        private int reseedOne(String seedURL, boolean echoStatus) {
    231237            try {
     238                final long timeLimit = _context.clock().now() + MAX_TIME_PER_HOST;
    232239                System.setProperty(PROP_STATUS, _("Reseeding: fetching seed URL."));
    233240                System.err.println("Reseeding from " + seedURL);
     
    268275                int errors = 0;
    269276                // 200 max from one URL
    270                 for (Iterator<String> iter = urlList.iterator(); iter.hasNext() && fetched < 200; ) {
     277                for (Iterator<String> iter = urlList.iterator();
     278                     iter.hasNext() && fetched < 200 && _context.clock().now() < timeLimit; ) {
    271279                    try {
    272280                        System.setProperty(PROP_STATUS,
Note: See TracChangeset for help on using the changeset viewer.