/** * A non-authoritative hint that a specific edition *might* exist. At the moment, we just fetch * the block. We do not fetch the contents, and it is possible that USKFetcher's are also fetching * the block. FIXME would it be more efficient to pass it along to a USKFetcher? * * @param context * @throws MalformedURLException If the uri passed in is not a USK. */ public void hintUpdate(FreenetURI uri, ClientContext context, short priority) throws MalformedURLException { if (uri.getSuggestedEdition() < lookupLatestSlot(USK.create(uri))) { if (logMINOR) Logger.minor( this, "Ignoring hint because edition is " + uri.getSuggestedEdition() + " but latest is " + lookupLatestSlot(USK.create(uri))); return; } uri = uri.sskForUSK(); if (logMINOR) Logger.minor(this, "Doing hint fetch for " + uri); final ClientGetter get = new ClientGetter( new NullClientCallback(), uri, new FetchContext(backgroundFetchContext, FetchContext.IDENTICAL_MASK, false, null), priority, rcBulk, new NullBucket(), null, null); try { get.start(null, context); } catch (FetchException e) { if (logMINOR) Logger.minor(this, "Cannot start hint fetch for " + uri + " : " + e, e); // Ignore } }
public void checkUSK( FreenetURI uri, boolean persistent, ObjectContainer container, boolean isMetadata) { try { if (persistent) container.activate(uri, 5); FreenetURI uu; if (uri.isSSK() && uri.isSSKForUSK()) { uu = uri.setMetaString(null).uskForSSK(); } else if (uri.isUSK()) { uu = uri; } else { return; } USK usk = USK.create(uu); if (!isMetadata) context.uskManager.updateKnownGood(usk, uu.getSuggestedEdition(), context); else // We don't know whether the metadata is fetchable. // FIXME add a callback so if the rest of the request completes we updateKnownGood(). context.uskManager.updateSlot(usk, uu.getSuggestedEdition(), context); } catch (MalformedURLException e) { Logger.error(this, "Caught " + e, e); } catch (Throwable t) { // Don't let the USK hint cause us to not succeed on the block. Logger.error(this, "Caught " + t, t); } }