@Override public String toString() { return "ClientSSK:"+getURI().toString(); }
Rijndael aes; try { Logger.minor(this, "cryptoAlgorithm="+key.cryptoAlgorithm+" for "+getClientKey().getURI()); aes = new Rijndael(256,256); } catch (UnsupportedCipherException e) {
@Override public synchronized void onSuccess(ClientPutState state, ClientContext context) { USK newEdition = pubUSK.copy(edition); finished = true; sbi = null; FreenetURI targetURI = pubUSK.getSSK(edition).getURI(); FreenetURI realURI = ((SingleBlockInserter)state).getURI(context); if(!targetURI.equals(realURI)) Logger.error(this, "URI should be "+targetURI+" actually is "+realURI); else { if(logMINOR) Logger.minor(this, "URI should be "+targetURI+" actually is "+realURI); context.uskManager.updateKnownGood(pubUSK, edition, context); } if(freeData) { data.free(); data = null; } cb.onEncode(newEdition, this, context); insertSucceeded(context, edition); // FINISHED!!!! Yay!!! }
@Override public void onFoundEdition(long l, USK newUSK, ClientContext context, boolean metadata, short codec, byte[] data, boolean newKnownGood, boolean newSlotToo) { if(l < usk.suggestedEdition && datastoreOnly) l = usk.suggestedEdition; ClientSSK key = usk.getSSK(l); try { if(l == usk.suggestedEdition) { SingleFileFetcher sf = new SingleFileFetcher(parent, cb, null, key, metaStrings, key.getURI().addMetaStrings(metaStrings), 0, ctx, false, realTimeFlag, actx, null, null, maxRetries, recursionLevel+1, dontTellClientGet, token, false, true, false, (short)0, context, false); if(tag != null) { cb.onTransition(tag, sf, context); } sf.schedule(context); } else { cb.onFailure(new FetchException(FetchExceptionMode.PERMANENT_REDIRECT, newUSK.getURI().addMetaStrings(metaStrings)), null, context); } } catch (FetchException e) { cb.onFailure(e, null, context); } }
@Override public void onFoundEdition(long l, USK key, 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; } if(l < origUSK.suggestedEdition) { Logger.warning(this, "Found edition prior to that specified by the client: "+l+" < "+origUSK.suggestedEdition); return; } if(logMINOR) Logger.minor(this, "Found edition "+l+" for "+this+" - fetching..."); // Create a SingleFileFetcher for the key (as an SSK). // Put the edition number into its context object. // Put ourself as callback. // Fetch it. If it fails, ignore it, if it succeeds, return the data with the edition # to the client. FreenetURI uri = key.getSSK(l).getURI(); try { SingleFileFetcher getter = (SingleFileFetcher) SingleFileFetcher.create(this, this, uri, ctx, new ArchiveContext(ctx.maxTempLength, ctx.maxArchiveLevels), ctx.maxNonSplitfileRetries, 0, true, l, true, false, context, realTimeFlag, false); getter.schedule(context); } catch (MalformedURLException e) { Logger.error(this, "Impossible: "+e, e); } catch (FetchException e) { Logger.error(this, "Could not start fetcher for "+uri+" : "+e, e); } }
Logger.error(this, "Unable to insert USK date hints due to disk I/O error: "+e, e); if(!added) { cb.onFailure(new InsertException(InsertExceptionMode.BUCKET_ERROR, e, pubUSK.getSSK(edition).getURI()), this, context); return;