コード例 #1
0
 public USKManager(NodeClientCore core) {
   HighLevelSimpleClient client =
       core.makeClient(RequestStarter.UPDATE_PRIORITY_CLASS, false, false);
   client.setMaxIntermediateLength(FProxyToadlet.MAX_LENGTH_NO_PROGRESS);
   client.setMaxLength(FProxyToadlet.MAX_LENGTH_NO_PROGRESS);
   backgroundFetchContext = client.getFetchContext();
   backgroundFetchContext.followRedirects = false;
   backgroundFetchContextIgnoreDBR = backgroundFetchContext.clone();
   backgroundFetchContextIgnoreDBR.ignoreUSKDatehints = true;
   realFetchContext = client.getFetchContext();
   // Performance: I'm pretty sure there is no spatial locality in the underlying data, so it's
   // okay to use the FAST_COMPARATOR here.
   // That is, even if two USKs are by the same author, they won't necessarily be updated or polled
   // at the same time.
   latestKnownGoodByClearUSK = new TreeMap<USK, Long>(USK.FAST_COMPARATOR);
   latestSlotByClearUSK = new TreeMap<USK, Long>(USK.FAST_COMPARATOR);
   subscribersByClearUSK = new TreeMap<USK, USKCallback[]>(USK.FAST_COMPARATOR);
   backgroundFetchersByClearUSK = new TreeMap<USK, USKFetcher>(USK.FAST_COMPARATOR);
   temporaryBackgroundFetchersLRU = LRUMap.createSafeMap(USK.FAST_COMPARATOR);
   temporaryBackgroundFetchersPrefetch = new WeakHashMap<USK, Long>();
   executor = core.getExecutor();
 }
コード例 #2
0
 private void addRequest(FreenetURI uri) {
   if (isRunning) {
     FetchContext mFetchContext = mFetcher.getFetchContext();
     mFetchContext.allowSplitfiles = true; // FIXME: disable as soon as its fixed!
     mFetchContext.canWriteClientCache = true;
     mFetchContext.dontEnterImplicitArchives = true; // ?
     mFetchContext.filterData = false; // ?
     mFetchContext.followRedirects = false;
     mFetchContext.ignoreStore = false;
     // final? mFetchContext.ignoreTooManyPathComponents = false;
     mFetchContext.ignoreUSKDatehints = true; // ?
     mFetchContext.localRequestOnly = false;
     mFetchContext.maxArchiveLevels = 0; // ?
     mFetchContext.maxArchiveRestarts = 0; // ?
     mFetchContext.maxCheckBlocksPerSegment = 0; // ?
     mFetchContext.maxDataBlocksPerSegment = 0; // ?
     // mFetchContext.maxMetadataSize = ?
     // cooldown for 30 minutes, wtf? this is a real time chat plugin.
     // mFetchContext.maxNonSplitfileRetries = -1;
     mFetchContext.maxNonSplitfileRetries = 2;
     // mFetchContext.maxOutputLength = 1024 ?
     mFetchContext.maxRecursionLevel = 0; // ?
     mFetchContext.maxSplitfileBlockRetries = 0;
     // mFetchContext.maxTempLength = ?
     // final? mFetchContext.maxUSKRetries = -1; //?
     // mFetchContext.overrideMIME = "text/plain"; //?
     // mFetchContext.prefetchHook = ?
     // mFetchContext.returnZIPManifests = true ?
     // mFetchContext.tagReplacer = ?
     // mFetchContext.setCooldownRetries(cooldownRetries);
     // mFetchContext.setCooldownTime(cooldownTime);
     try {
       mFetcher.fetch(uri, this, this, mFetchContext, (short) 1);
     } catch (FetchException e) {
       System.err.println(
           "[Async_AnnounceFetcher]::addRequest() FetchException: " + e.getMessage());
     }
   }
 }