Author: toad
Date: 2009-04-23 17:22:45 +0000 (Thu, 23 Apr 2009)
New Revision: 27264

Modified:
   trunk/freenet/src/freenet/client/async/USKFetcher.java
Log:
Revert and document


Modified: trunk/freenet/src/freenet/client/async/USKFetcher.java
===================================================================
--- trunk/freenet/src/freenet/client/async/USKFetcher.java      2009-04-23 
16:56:49 UTC (rev 27263)
+++ trunk/freenet/src/freenet/client/async/USKFetcher.java      2009-04-23 
17:22:45 UTC (rev 27264)
@@ -670,11 +670,14 @@
 
        public void onFoundEdition(long ed, USK key, ObjectContainer container, 
final ClientContext context, boolean metadata, short codec, byte[] data, 
boolean newKnownGood, boolean newSlotToo) {
                if(newKnownGood && !newSlotToo) return; // Only interested in 
slots
+               // Because this is frequently run off-thread, it is actually 
possible that the looked up edition is not the same as the edition we are being 
notified of.
+               final long lastEd = uskManager.lookupLatestSlot(origUSK);
                boolean decode = false;
                Vector<USKAttempt> killAttempts;
                synchronized(this) {
                        if(completed || cancelled) return;
-                       decode = data != null;
+                       decode = lastEd >= ed && data != null;
+                       ed = Math.max(lastEd, ed);
                        if(logMINOR) Logger.minor(this, "Latest: "+ed);
                        long addTo = ed + minFailures;
                        long addFrom = Math.max(lastAddedEdition + 1, ed + 1);

_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to