r26976 - trunk/freenet/src/freenet/client/async
[email protected] Sat, 18 Apr 2009 15:23:11 +0000
| Newsgroups | gmane.network.freenet.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: toad
Date: 2009-04-18 15:23:10 +0000 (Sat, 18 Apr 2009)
New Revision: 26976
Modified:
trunk/freenet/src/freenet/client/async/USKManager.java
Log:
Content fetch would keep running forever: run a USKFetcher for the last known slot, when it decides that it is still the last known slot, fetch it, which then starts another USKFetcher which again fetches it. Do not fetch the content unless it is a higher edition than the last known good editio!
Modified: trunk/freenet/src/freenet/client/async/USKManager.java
===================================================================
--- trunk/freenet/src/freenet/client/async/USKManager.java 2009-04-18 14:46:55 UTC (rev 26975)
+++ trunk/freenet/src/freenet/client/async/USKManager.java 2009-04-18 15:23:10 UTC (rev 26976)
@@ -144,9 +144,9 @@
sched = f;
temporaryBackgroundFetchersLRU.push(clear, f);
}
- if(prefetchContent)
+ if(prefetchContent) {
+ final long min = lookupKnownGood(usk);
f.addCallback(new USKFetcherCallback() {
-
public void onCancelled(ObjectContainer container, ClientContext context) {
// Ok
}
@@ -156,6 +156,7 @@
}
public void onFoundEdition(long l, USK key, ObjectContainer container, ClientContext context, boolean metadata, short codec, byte[] data, boolean newKnownGood, boolean newSlotToo) {
+ if(l <= min) return;
FreenetURI uri = key.copy(l).getURI();
final ClientGetter get = new ClientGetter(new NullClientCallback(), uri, new FetchContext(fctx, FetchContext.IDENTICAL_MASK, false, null), RequestStarter.UPDATE_PRIORITY_CLASS, USKManager.this, new NullBucket(), null);
try {
@@ -175,6 +176,7 @@
});
+ }
temporaryBackgroundFetchersLRU.push(clear, f);
while(temporaryBackgroundFetchersLRU.size() > NodeClientCore.maxBackgroundUSKFetchers) {
USKFetcher fetcher = temporaryBackgroundFetchersLRU.popValue();