/** If the key is a USK and a) we are requested to do an exhaustive search, or b) * there is a later version, then we can't use the download queue as a cache. * @return True if we can't use the download queue, false if we can. */ private boolean bogusUSK(ClientContext context) { if(!uri.isUSK()) return false; long edition = uri.getSuggestedEdition(); if(edition < 0) return true; // Need to do the fetch. USK usk; try { usk = USK.create(uri); } catch (MalformedURLException e) { return false; // Will fail later. } long ret = context.uskManager.lookupKnownGood(usk); if(ret == -1) return false; return ret > edition; }
USK clear = entry.getKey(); long l = lookupLatestSlot(clear); if(lookupKnownGood(clear) < l) toFetch.add(clear.copy(l));
curEd = lookupLatestSlot(origUSK); long goodEd; goodEd = lookupKnownGood(origUSK); synchronized(this) { USK clear = origUSK.clearCopy();
long good = lookupKnownGood(clear); if(slot > -1 && good != slot) fetchTime = System.currentTimeMillis();
private static ClientGetState uskCreate(ClientRequester requester, boolean realTimeFlag, GetCompletionCallback cb, USK usk, ArrayList<String> metaStrings, FetchContext ctx, ArchiveContext actx, int maxRetries, int recursionLevel, boolean dontTellClientGet, long l, boolean isEssential, boolean isFinal, ClientContext context) throws FetchException { if(usk.suggestedEdition >= 0) { long edition = context.uskManager.lookupKnownGood(usk); if(edition <= usk.suggestedEdition) { context.uskManager.startTemporaryBackgroundFetcher(usk, context, ctx, true, realTimeFlag); edition = context.uskManager.lookupKnownGood(usk); if(edition > usk.suggestedEdition) { if(logMINOR) Logger.minor(SingleFileFetcher.class, "Redirecting to edition "+edition);
if(fr.hasData()) { if(fr.getFetchCount() > 1 && !fr.hasWaited() && fr.getFetchCount() > 1 && key.isUSK() && context.uskManager.lookupKnownGood(USK.create(key)) > key.getSuggestedEdition()) { Logger.normal(this, "Loading later edition..."); fetch.progress.requestImmediateCancel();