* NewsFetcher: Fix bug causing fetch every 10m
This commit is contained in:
@ -41,14 +41,16 @@ public class NewsFetcher implements Runnable, EepGet.StatusListener {
|
||||
_context = ctx;
|
||||
_log = ctx.logManager().getLog(NewsFetcher.class);
|
||||
_instance = this;
|
||||
_lastFetch = 0;
|
||||
updateLastFetched();
|
||||
}
|
||||
|
||||
private void updateLastFetched() {
|
||||
File news = new File(NEWS_FILE);
|
||||
if (news.exists())
|
||||
_lastFetch = news.lastModified();
|
||||
else
|
||||
if (news.exists()) {
|
||||
if (_lastFetch == 0)
|
||||
_lastFetch = news.lastModified();
|
||||
} else
|
||||
_lastFetch = 0;
|
||||
}
|
||||
|
||||
@ -115,8 +117,6 @@ public class NewsFetcher implements Runnable, EepGet.StatusListener {
|
||||
} catch (Throwable t) {
|
||||
_log.error("Error fetching the news", t);
|
||||
}
|
||||
|
||||
_lastFetch = _context.clock().now();
|
||||
}
|
||||
|
||||
private static final String VERSION_STRING = "version=\"" + RouterVersion.VERSION + "\"";
|
||||
@ -209,6 +209,7 @@ public class NewsFetcher implements Runnable, EepGet.StatusListener {
|
||||
boolean copied = FileUtil.copy(TEMP_NEWS_FILE, NEWS_FILE, true);
|
||||
if (copied) {
|
||||
temp.delete();
|
||||
checkForUpdates();
|
||||
} else {
|
||||
if (_log.shouldLog(Log.ERROR))
|
||||
_log.error("Failed to copy the news file!");
|
||||
@ -217,7 +218,7 @@ public class NewsFetcher implements Runnable, EepGet.StatusListener {
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Transfer complete, but no file? - probably 304 Not Modified");
|
||||
}
|
||||
checkForUpdates();
|
||||
_lastFetch = _context.clock().now();
|
||||
}
|
||||
|
||||
public void transferFailed(String url, long bytesTransferred, long bytesRemaining, int currentAttempt) {
|
||||
|
@ -1,3 +1,6 @@
|
||||
2008-03-22 zzz
|
||||
* NewsFetcher: Fix bug causing fetch every 10m
|
||||
|
||||
2008-03-22 zzz
|
||||
* Tunnel Testing:
|
||||
- Fix counting so it really takes 4 consecutive failures
|
||||
|
@ -17,7 +17,7 @@ import net.i2p.CoreVersion;
|
||||
public class RouterVersion {
|
||||
public final static String ID = "$Revision: 1.548 $ $Date: 2008-02-10 15:00:00 $";
|
||||
public final static String VERSION = "0.6.1.32";
|
||||
public final static long BUILD = 9;
|
||||
public final static long BUILD = 10;
|
||||
public static void main(String args[]) {
|
||||
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
|
||||
System.out.println("Router ID: " + RouterVersion.ID);
|
||||
|
Reference in New Issue
Block a user