Author: toad
Date: 2009-04-15 17:06:14 +0000 (Wed, 15 Apr 2009)
New Revision: 26849

Modified:
   trunk/freenet/src/freenet/client/async/SingleFileFetcher.java
   trunk/freenet/src/freenet/client/async/USKCallback.java
   trunk/freenet/src/freenet/client/async/USKFetcher.java
   trunk/freenet/src/freenet/client/async/USKFetcherCallback.java
   trunk/freenet/src/freenet/client/async/USKFetcherTag.java
   trunk/freenet/src/freenet/client/async/USKInserter.java
   trunk/freenet/src/freenet/client/async/USKManager.java
   trunk/freenet/src/freenet/client/async/USKProxyCompletionCallback.java
   trunk/freenet/src/freenet/client/async/USKRetriever.java
   trunk/freenet/src/freenet/clients/http/bookmark/BookmarkManager.java
   trunk/freenet/src/freenet/node/fcp/SubscribeUSK.java
   trunk/freenet/src/freenet/node/updater/NodeUpdater.java
Log:
USKs: Track last known slot and last known good version separately. USKFetcher 
starts at the last known slot, but what we display in fproxy is the last known 
good version.


Modified: trunk/freenet/src/freenet/client/async/SingleFileFetcher.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SingleFileFetcher.java       
2009-04-15 17:04:38 UTC (rev 26848)
+++ trunk/freenet/src/freenet/client/async/SingleFileFetcher.java       
2009-04-15 17:06:14 UTC (rev 26849)
@@ -1075,11 +1075,11 @@
        private static ClientGetState uskCreate(ClientRequester requester, 
GetCompletionCallback cb, USK usk, ArrayList<String> metaStrings, FetchContext 
ctx, ArchiveContext actx, int maxRetries, int recursionLevel, boolean 
dontTellClientGet, long l, boolean isEssential, Bucket returnBucket, boolean 
isFinal, ObjectContainer container, ClientContext context) throws 
FetchException {
                if(usk.suggestedEdition >= 0) {
                        // Return the latest known version but at least 
suggestedEdition.
-                       long edition = context.uskManager.lookup(usk);
+                       long edition = context.uskManager.lookupKnownGood(usk);
                        if(edition <= usk.suggestedEdition) {
                                // Background fetch - start background fetch 
first so can pick up updates in the datastore during registration.
                                
context.uskManager.startTemporaryBackgroundFetcher(usk, context);
-                               edition = context.uskManager.lookup(usk);
+                               edition = 
context.uskManager.lookupKnownGood(usk);
                                if(edition > usk.suggestedEdition) {
                                        if(logMINOR) 
Logger.minor(SingleFileFetcher.class, "Redirecting to edition "+edition);
                                        cb.onFailure(new 
FetchException(FetchException.PERMANENT_REDIRECT, 
usk.copy(edition).getURI().addMetaStrings(metaStrings)), null, container, 
context);
@@ -1140,7 +1140,7 @@
                        this.persistent = persistent;
                }
 
-               public void onFoundEdition(long l, USK newUSK, ObjectContainer 
container, ClientContext context, boolean metadata, short codec, byte[] data) {
+               public void onFoundEdition(long l, USK newUSK, ObjectContainer 
container, ClientContext context, boolean metadata, short codec, byte[] data, 
boolean newKnownGood, boolean newSlotToo) {
                        if(persistent)
                                container.activate(this, 2);
                        ClientSSK key = usk.getSSK(l);

Modified: trunk/freenet/src/freenet/client/async/USKCallback.java
===================================================================
--- trunk/freenet/src/freenet/client/async/USKCallback.java     2009-04-15 
17:04:38 UTC (rev 26848)
+++ trunk/freenet/src/freenet/client/async/USKCallback.java     2009-04-15 
17:06:14 UTC (rev 26849)
@@ -20,8 +20,15 @@
         *            The edition number.
         * @param key
         *            A copy of the key with new edition set
+        * @param newKnownGood If the highest known good edition (which has 
actually been
+        * fetched with what it pointed to) has increased. Otherwise, the 
highest known
+        * SSK slot has been increased, from which searches will start, but we 
do not 
+        * know whether it can actually be fetched successfully.
+        * @param newSlotToo If newKnownGood is set, this indicates whether it 
is also a
+        * new highest known SSK slot. If newKnownGood is not set, there is 
always a new
+        * highest known SSK slot.
         */
-       void onFoundEdition(long l, USK key, ObjectContainer container, 
ClientContext context, boolean metadata, short codec, byte[] data);
+       void onFoundEdition(long l, USK key, ObjectContainer container, 
ClientContext context, boolean metadata, short codec, byte[] data, boolean 
newKnownGood, boolean newSlotToo);
        
        /**
         * Priority at which the polling should run normally.

Modified: trunk/freenet/src/freenet/client/async/USKFetcher.java
===================================================================
--- trunk/freenet/src/freenet/client/async/USKFetcher.java      2009-04-15 
17:04:38 UTC (rev 26848)
+++ trunk/freenet/src/freenet/client/async/USKFetcher.java      2009-04-15 
17:06:14 UTC (rev 26849)
@@ -251,7 +251,7 @@
        void onDNF(USKAttempt att, ClientContext context) {
                if(logMINOR) Logger.minor(this, "DNF: "+att);
                boolean finished = false;
-               long curLatest = uskManager.lookup(origUSK);
+               long curLatest = uskManager.lookupLatestSlot(origUSK);
                synchronized(this) {
                        if(completed || cancelled) return;
                        lastFetchedEdition = Math.max(lastFetchedEdition, 
att.number);
@@ -270,7 +270,7 @@
        
        private void finishSuccess(ClientContext context) {
                if(backgroundPoll) {
-                       long valAtEnd = uskManager.lookup(origUSK);
+                       long valAtEnd = uskManager.lookupLatestSlot(origUSK);
                        long end;
                        long now = System.currentTimeMillis();
                        synchronized(this) {
@@ -301,7 +301,7 @@
                        schedule(end-now, null, context);
                } else {
                        uskManager.unsubscribe(origUSK, this, false);
-                       long ed = uskManager.lookup(origUSK);
+                       long ed = uskManager.lookupLatestSlot(origUSK);
                        USKFetcherCallback[] cb;
                        synchronized(this) {
                                completed = true;
@@ -320,7 +320,7 @@
                        }
                        for(int i=0;i<cb.length;i++) {
                                try {
-                                       cb[i].onFoundEdition(ed, 
origUSK.copy(ed), null, context, lastWasMetadata, lastCompressionCodec, data);
+                                       cb[i].onFoundEdition(ed, 
origUSK.copy(ed), null, context, lastWasMetadata, lastCompressionCodec, data, 
false, false);
                                } catch (Exception e) {
                                        Logger.error(this, "An exception 
occured while dealing with a callback:"+cb[i].toString()+"\n"+e.getMessage(),e);
                                }
@@ -330,7 +330,7 @@
 
        void onSuccess(USKAttempt att, boolean dontUpdate, ClientSSKBlock 
block, final ClientContext context) {
                LinkedList<USKAttempt> l = null;
-               final long lastEd = uskManager.lookup(origUSK);
+               final long lastEd = uskManager.lookupLatestSlot(origUSK);
                long curLatest;
                boolean decode = false;
                synchronized(this) {
@@ -376,7 +376,7 @@
                        }
                }
                if(!dontUpdate)
-                       uskManager.update(origUSK, curLatest, context);
+                       uskManager.updateSlot(origUSK, curLatest, context);
                if(l == null) return;
                final LinkedList<USKAttempt> toSched = l;
                // If we schedule them here, we don't get icky recursion 
problems.
@@ -388,7 +388,7 @@
                                                // We may be called recursively 
through onSuccess().
                                                // So don't start obsolete 
requests.
                                                USKAttempt a = i.next();
-                                               last = 
uskManager.lookup(origUSK);
+                                               last = 
uskManager.lookupLatestSlot(origUSK);
                                                if((last <= a.number) && 
!a.cancelled)
                                                        a.schedule(null, 
context);
                                                else {
@@ -503,7 +503,7 @@
        public void schedule(ObjectContainer container, ClientContext context) {
                uskManager.subscribe(origUSK, this, false, parent.getClient());
                USKAttempt[] attempts;
-               long lookedUp = uskManager.lookup(origUSK);
+               long lookedUp = uskManager.lookupLatestSlot(origUSK);
                synchronized(this) {
                        valueAtSchedule = Math.max(lookedUp, valueAtSchedule);
                        if(cancelled) return;
@@ -516,7 +516,7 @@
                if(!cancelled) {
                        for(int i=0;i<attempts.length;i++) {
                                // Race conditions happen here and waste a lot 
more time than this simple check.
-                               long lastEd = uskManager.lookup(origUSK);
+                               long lastEd = 
uskManager.lookupLatestSlot(origUSK);
                                if(keepLastData && lastEd == lookedUp)
                                        lastEd--; // If we want the data, then 
get it for the known edition, so we always get the data, so USKInserter can 
compare it and return the old edition if it is identical.
                                if(attempts[i].number > lastEd)
@@ -647,9 +647,10 @@
                throw new UnsupportedOperationException();
        }
 
-       public void onFoundEdition(long ed, USK key, ObjectContainer container, 
final ClientContext context, boolean metadata, short codec, byte[] data) {
+       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
                LinkedList<USKAttempt> l = null;
-               final long lastEd = uskManager.lookup(origUSK);
+               final long lastEd = uskManager.lookupLatestSlot(origUSK);
                boolean decode = false;
                synchronized(this) {
                        if(completed || cancelled) return;
@@ -695,7 +696,7 @@
                                                // We may be called recursively 
through onSuccess().
                                                // So don't start obsolete 
requests.
                                                USKAttempt a = i.next();
-                                               last = 
uskManager.lookup(origUSK);
+                                               last = 
uskManager.lookupLatestSlot(origUSK);
                                                if((last <= a.number) && 
!a.cancelled)
                                                        a.schedule(null, 
context);
                                                else {

Modified: trunk/freenet/src/freenet/client/async/USKFetcherCallback.java
===================================================================
--- trunk/freenet/src/freenet/client/async/USKFetcherCallback.java      
2009-04-15 17:04:38 UTC (rev 26848)
+++ trunk/freenet/src/freenet/client/async/USKFetcherCallback.java      
2009-04-15 17:06:14 UTC (rev 26849)
@@ -22,6 +22,6 @@
        /** Found the latest edition. **This is terminal for a 
USKFetcherCallback**. It isn't for a USKCallback subscription.
         * @param l The edition number.
         * @param key The key. */
-       void onFoundEdition(long l, USK key, ObjectContainer container, 
ClientContext context, boolean metadata, short codec, byte[] data);
+       void onFoundEdition(long l, USK key, ObjectContainer container, 
ClientContext context, boolean metadata, short codec, byte[] data, boolean 
newKnownGood, boolean newSlotToo);
        
 }

Modified: trunk/freenet/src/freenet/client/async/USKFetcherTag.java
===================================================================
--- trunk/freenet/src/freenet/client/async/USKFetcherTag.java   2009-04-15 
17:04:38 UTC (rev 26848)
+++ trunk/freenet/src/freenet/client/async/USKFetcherTag.java   2009-04-15 
17:06:14 UTC (rev 26849)
@@ -179,7 +179,7 @@
                return pollingPriorityProgress;
        }
 
-       public void onFoundEdition(final long l, final USK key, ObjectContainer 
container, ClientContext context, final boolean metadata, final short codec, 
final byte[] data) {
+       public void onFoundEdition(final long l, final USK key, ObjectContainer 
container, ClientContext context, final boolean metadata, final short codec, 
final byte[] data, final boolean newKnownGood, final boolean newSlotToo) {
                synchronized(this) {
                        if(fetcher == null) {
                                Logger.error(this, "onFoundEdition but fetcher 
is null - isn't onFoundEdition() terminal for USKFetcherCallback's??", new 
Exception("debug"));
@@ -190,7 +190,7 @@
                if(persistent) {
                        if(container != null) {
                                container.activate(callback, 1);
-                               callback.onFoundEdition(l, key, container, 
context, metadata, codec, data);
+                               callback.onFoundEdition(l, key, container, 
context, metadata, codec, data, newKnownGood, newSlotToo);
                                container.deactivate(callback, 1);
                                removeFrom(container, context);
                        } else {
@@ -198,7 +198,7 @@
 
                                public void run(ObjectContainer container, 
ClientContext context) {
                                        container.activate(callback, 1);
-                                       callback.onFoundEdition(l, key, 
container, context, metadata, codec, data);
+                                       callback.onFoundEdition(l, key, 
container, context, metadata, codec, data, newKnownGood, newSlotToo);
                                        container.deactivate(callback, 1);
                                        removeFrom(container, context);
                                }
@@ -206,7 +206,7 @@
                        }, NativeThread.HIGH_PRIORITY, false);
                        }
                } else {
-                       callback.onFoundEdition(l, key, container, context, 
metadata, codec, data);
+                       callback.onFoundEdition(l, key, container, context, 
metadata, codec, data, newKnownGood, newSlotToo);
                }
        }
 

Modified: trunk/freenet/src/freenet/client/async/USKInserter.java
===================================================================
--- trunk/freenet/src/freenet/client/async/USKInserter.java     2009-04-15 
17:04:38 UTC (rev 26848)
+++ trunk/freenet/src/freenet/client/async/USKInserter.java     2009-04-15 
17:06:14 UTC (rev 26849)
@@ -92,7 +92,7 @@
                fetcher.schedule(container, context);
        }
 
-       public void onFoundEdition(long l, USK key, ObjectContainer container, 
ClientContext context, boolean lastContentWasMetadata, short codec, byte[] 
hisData) {
+       public void onFoundEdition(long l, USK key, ObjectContainer container, 
ClientContext context, boolean lastContentWasMetadata, short codec, byte[] 
hisData, boolean newKnownGood, boolean newSlotToo) {
                boolean alreadyInserted = false;
                synchronized(this) {
                        edition = Math.max(l, edition);
@@ -142,7 +142,7 @@
        }
 
        private void scheduleInsert(ObjectContainer container, ClientContext 
context) {
-               long edNo = Math.max(edition, 
context.uskManager.lookup(pubUSK)+1);
+               long edNo = Math.max(edition, 
context.uskManager.lookupLatestSlot(pubUSK)+1);
                if(persistent) {
                        container.activate(privUSK, 5);
                        container.activate(pubUSK, 5);
@@ -187,7 +187,7 @@
                else {
                        if(Logger.shouldLog(Logger.MINOR, this))
                                Logger.minor(this, "URI should be "+targetURI+" 
actually is "+realURI);
-                       context.uskManager.update(pubUSK, edition, context);
+                       context.uskManager.updateKnownGood(pubUSK, edition, 
context);
                }
                if(persistent) state.removeFrom(container, context);
                if(freeData) {

Modified: trunk/freenet/src/freenet/client/async/USKManager.java
===================================================================
--- trunk/freenet/src/freenet/client/async/USKManager.java      2009-04-15 
17:04:38 UTC (rev 26848)
+++ trunk/freenet/src/freenet/client/async/USKManager.java      2009-04-15 
17:06:14 UTC (rev 26849)
@@ -25,9 +25,12 @@
  */
 public class USKManager implements RequestClient {
 
-       /** Latest version by blanked-edition-number USK */
-       final HashMap<USK, Long> latestVersionByClearUSK;
+       /** Latest version successfully fetched by blanked-edition-number USK */
+       final HashMap<USK, Long> latestKnownGoodByClearUSK;
        
+       /** Latest SSK slot known to be by the author by blanked-edition-number 
USK */
+       final HashMap<USK, Long> latestSlotByClearUSK;
+       
        /** Subscribers by clear USK */
        final HashMap<USK, USKCallback[]> subscribersByClearUSK;
        
@@ -49,7 +52,8 @@
        public USKManager(NodeClientCore core) {
                backgroundFetchContext = 
core.makeClient(RequestStarter.UPDATE_PRIORITY_CLASS).getFetchContext();
                backgroundFetchContext.followRedirects = false;
-               latestVersionByClearUSK = new HashMap<USK, Long>();
+               latestKnownGoodByClearUSK = new HashMap<USK, Long>();
+               latestSlotByClearUSK = new HashMap<USK, Long>();
                subscribersByClearUSK = new HashMap<USK, USKCallback[]>();
                fetchersByUSK = new HashMap<USK, USKFetcher>();
                backgroundFetchersByClearUSK = new HashMap<USK, USKFetcher>();
@@ -63,16 +67,28 @@
        }
        
        /**
-        * Look up the latest known version of the given USK.
+        * Look up the latest known working version of the given USK.
         * @return The latest known edition number, or -1.
         */
-       public synchronized long lookup(USK usk) {
-               Long l = latestVersionByClearUSK.get(usk.clearCopy());
+       public synchronized long lookupKnownGood(USK usk) {
+               Long l = latestKnownGoodByClearUSK.get(usk.clearCopy());
                if(l != null)
                        return l.longValue();
                else return -1;
        }
 
+       /**
+        * Look up the latest SSK slot, whether the data it links to has been 
successfully
+        * fetched or not, of the given USK.
+        * @return The latest known edition number, or -1.
+        */
+       public synchronized long lookupLatestSlot(USK usk) {
+               Long l = latestSlotByClearUSK.get(usk.clearCopy());
+               if(l != null)
+                       return l.longValue();
+               else return -1;
+       }
+
        public USKFetcherTag getFetcher(USK usk, FetchContext ctx, boolean 
keepLast, boolean persistent, 
                        USKFetcherCallback callback, boolean ownFetchContext, 
ObjectContainer container, ClientContext context) {
                return USKFetcherTag.create(usk, callback, 
context.nodeDBHandle, persistent, container, ctx, keepLast, 0, ownFetchContext);
@@ -139,34 +155,77 @@
                if(sched != null) sched.schedule(null, context);
        }
        
-       void update(final USK origUSK, final long number, final ClientContext 
context) {
+       void updateKnownGood(final USK origUSK, final long number, final 
ClientContext context) {
                boolean logMINOR = Logger.shouldLog(Logger.MINOR, this);
                if(logMINOR) Logger.minor(this, "Updating "+origUSK.getURI()+" 
: "+number);
                USK clear = origUSK.clearCopy();
                final USKCallback[] callbacks;
+               boolean newSlot = false;
                synchronized(this) {
-                       Long l = latestVersionByClearUSK.get(clear);
-                       if(logMINOR) Logger.minor(this, "Old value: "+l);
+                       Long l = latestKnownGoodByClearUSK.get(clear);
+                       if(logMINOR) Logger.minor(this, "Old known good: "+l);
                        if((l == null) || (number > l.longValue())) {
                                l = Long.valueOf(number);
-                               latestVersionByClearUSK.put(clear, l);
+                               latestKnownGoodByClearUSK.put(clear, l);
                                if(logMINOR) Logger.minor(this, "Put "+number);
-                       } else return;
+                       } else
+                               return; // If it's in KnownGood, it will also 
be in Slot
+                       
+                       l = latestSlotByClearUSK.get(clear);
+                       if(logMINOR) Logger.minor(this, "Old slot: "+l);
+                       if((l == null) || (number > l.longValue())) {
+                               l = Long.valueOf(number);
+                               latestSlotByClearUSK.put(clear, l);
+                               if(logMINOR) Logger.minor(this, "Put "+number);
+                               newSlot = true;
+                       } 
+                       
                        callbacks = subscribersByClearUSK.get(clear);
                }
                if(callbacks != null) {
                        // Run off-thread, because of locking, and because 
client callbacks may take some time
                                        final USK usk = origUSK.copy(number);
+                                       final boolean newSlotToo = newSlot;
                                        for(final USKCallback callback : 
callbacks)
                                                
context.mainExecutor.execute(new Runnable() {
                                                        public void run() {
                                                                
callback.onFoundEdition(number, usk, null, // non-persistent
-                                                                               
context, false, (short)-1, null);
+                                                                               
context, false, (short)-1, null, true, newSlotToo);
                                                        }
                                                }, "USKManager callback 
executor for " +callback);
                                }
        }
        
+       void updateSlot(final USK origUSK, final long number, final 
ClientContext context) {
+               boolean logMINOR = Logger.shouldLog(Logger.MINOR, this);
+               if(logMINOR) Logger.minor(this, "Updating "+origUSK.getURI()+" 
: "+number);
+               USK clear = origUSK.clearCopy();
+               final USKCallback[] callbacks;
+               synchronized(this) {
+                       Long l = latestSlotByClearUSK.get(clear);
+                       if(logMINOR) Logger.minor(this, "Old slot: "+l);
+                       if((l == null) || (number > l.longValue())) {
+                               l = Long.valueOf(number);
+                               latestSlotByClearUSK.put(clear, l);
+                               if(logMINOR) Logger.minor(this, "Put "+number);
+                       } else
+                               return;
+                       
+                       callbacks = subscribersByClearUSK.get(clear);
+               }
+               if(callbacks != null) {
+                       // Run off-thread, because of locking, and because 
client callbacks may take some time
+                                       final USK usk = origUSK.copy(number);
+                                       for(final USKCallback callback : 
callbacks)
+                                               
context.mainExecutor.execute(new Runnable() {
+                                                       public void run() {
+                                                               
callback.onFoundEdition(number, usk, null, // non-persistent
+                                                                               
context, false, (short)-1, null, false, false);
+                                                       }
+                                               }, "USKManager callback 
executor for " +callback);
+                               }
+       }
+       
        /**
         * Subscribe to a given USK. Callback will be notified when it is
         * updated. Note that this does not imply that the USK will be
@@ -181,7 +240,9 @@
                        ed = -ed;
                }
                long curEd;
-               curEd = lookup(origUSK);
+               curEd = lookupLatestSlot(origUSK);
+               long goodEd;
+               goodEd = lookupKnownGood(origUSK);
                synchronized(this) {
                        USK clear = origUSK.clearCopy();
                        USKCallback[] callbacks = 
subscribersByClearUSK.get(clear);
@@ -206,8 +267,10 @@
                                f.addSubscriber(cb);
                        }
                }
-               if(curEd > ed)
-                       cb.onFoundEdition(curEd, origUSK.copy(curEd), null, 
context, false, (short)-1, null);
+               if(goodEd > ed)
+                       cb.onFoundEdition(goodEd, origUSK.copy(curEd), null, 
context, false, (short)-1, null, true, curEd > ed);
+               else if(curEd > ed)
+                       cb.onFoundEdition(curEd, origUSK.copy(curEd), null, 
context, false, (short)-1, null, false, false);
                final USKFetcher fetcher = sched;
                if(fetcher != null) {
                        executor.execute(new Runnable() {

Modified: trunk/freenet/src/freenet/client/async/USKProxyCompletionCallback.java
===================================================================
--- trunk/freenet/src/freenet/client/async/USKProxyCompletionCallback.java      
2009-04-15 17:04:38 UTC (rev 26848)
+++ trunk/freenet/src/freenet/client/async/USKProxyCompletionCallback.java      
2009-04-15 17:06:14 UTC (rev 26849)
@@ -27,7 +27,7 @@
                        container.activate(cb, 1);
                        container.activate(usk, 5);
                }
-               context.uskManager.update(usk, usk.suggestedEdition, context);
+               context.uskManager.updateKnownGood(usk, usk.suggestedEdition, 
context);
                cb.onSuccess(result, state, container, context);
                if(persistent) removeFrom(container);
        }

Modified: trunk/freenet/src/freenet/client/async/USKRetriever.java
===================================================================
--- trunk/freenet/src/freenet/client/async/USKRetriever.java    2009-04-15 
17:04:38 UTC (rev 26848)
+++ trunk/freenet/src/freenet/client/async/USKRetriever.java    2009-04-15 
17:06:14 UTC (rev 26849)
@@ -34,7 +34,7 @@
                this.cb = cb;
        }
 
-       public void onFoundEdition(long l, USK key, ObjectContainer container, 
ClientContext context, boolean metadata, short codec, byte[] data) {
+       public void onFoundEdition(long l, USK key, ObjectContainer container, 
ClientContext context, boolean metadata, short codec, byte[] data, boolean 
newKnownGood, boolean newSlotToo) {
                if(l < 0) {
                        Logger.error(this, "Found negative edition: "+l+" for 
"+key+" !!!");
                        return;

Modified: trunk/freenet/src/freenet/clients/http/bookmark/BookmarkManager.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/bookmark/BookmarkManager.java        
2009-04-15 17:04:38 UTC (rev 26848)
+++ trunk/freenet/src/freenet/clients/http/bookmark/BookmarkManager.java        
2009-04-15 17:06:14 UTC (rev 26849)
@@ -97,7 +97,7 @@
 
        private class USKUpdatedCallback implements USKCallback {
 
-               public void onFoundEdition(long edition, USK key, 
ObjectContainer container, ClientContext context, boolean wasMetadata, short 
codec, byte[] data) {
+               public void onFoundEdition(long edition, USK key, 
ObjectContainer container, ClientContext context, boolean wasMetadata, short 
codec, byte[] data, boolean newKnownGood, boolean newSlotToo) {
                        List<BookmarkItem> items = MAIN_CATEGORY.getAllItems();
                        for(int i = 0; i < items.size(); i++) {
                                if(!"USK".equals(items.get(i).getKeyType()))

Modified: trunk/freenet/src/freenet/node/fcp/SubscribeUSK.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/SubscribeUSK.java        2009-04-15 
17:04:38 UTC (rev 26848)
+++ trunk/freenet/src/freenet/node/fcp/SubscribeUSK.java        2009-04-15 
17:06:14 UTC (rev 26849)
@@ -31,11 +31,12 @@
                core.uskManager.subscribe(message.key, this, !message.dontPoll, 
handler.getRebootClient().lowLevelClient);
        }
 
-       public void onFoundEdition(long l, USK key, ObjectContainer container, 
ClientContext context, boolean wasMetadata, short codec, byte[] data) {
+       public void onFoundEdition(long l, USK key, ObjectContainer container, 
ClientContext context, boolean wasMetadata, short codec, byte[] data, boolean 
newKnownGood, boolean newSlotToo) {
                if(handler.isClosed()) {
                        core.uskManager.unsubscribe(key, this, !dontPoll);
                        return;
                }
+               if(newKnownGood && !newSlotToo) return;
                FCPMessage msg = new SubscribedUSKUpdate(identifier, l, key);
                handler.outputHandler.queue(msg);
        }

Modified: trunk/freenet/src/freenet/node/updater/NodeUpdater.java
===================================================================
--- trunk/freenet/src/freenet/node/updater/NodeUpdater.java     2009-04-15 
17:04:38 UTC (rev 26848)
+++ trunk/freenet/src/freenet/node/updater/NodeUpdater.java     2009-04-15 
17:06:14 UTC (rev 26849)
@@ -97,7 +97,8 @@
                }
        }
        
-       public void onFoundEdition(long l, USK key, ObjectContainer container, 
ClientContext context, boolean wasMetadata, short codec, byte[] data) {
+       public void onFoundEdition(long l, USK key, ObjectContainer container, 
ClientContext context, boolean wasMetadata, short codec, byte[] data, boolean 
newKnownGood, boolean newSlotToo) {
+               if(newKnownGood && !newSlotToo) return;
                logMINOR = Logger.shouldLog(Logger.MINOR, this);
                if(logMINOR)
                        Logger.minor(this, "Found edition " + l);

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

Reply via email to