Beispiel #1
0
 /**
  * After we get the data we were searching for, rebroadcast it to the peers we would query first
  * if we were to search for it again (healing the network).
  */
 private void resend() {
   DatabaseEntry ds = _facade.lookupLeaseSetLocally(_state.getTarget());
   if (ds == null) {
     if (SHOULD_RESEND_ROUTERINFO) {
       ds = _facade.lookupRouterInfoLocally(_state.getTarget());
       if (ds != null)
         _facade.sendStore(
             _state.getTarget(), ds, null, null, RESEND_TIMEOUT, _state.getSuccessful());
     }
   } else {
     Set sendTo = _state.getRepliedPeers(); // _state.getFailed();
     sendTo.addAll(_state.getPending());
     int numSent = 0;
     for (Iterator iter = sendTo.iterator(); iter.hasNext(); ) {
       Hash peer = (Hash) iter.next();
       RouterInfo peerInfo = _facade.lookupRouterInfoLocally(peer);
       if (peerInfo == null) continue;
       if (resend(peerInfo, (LeaseSet) ds)) numSent++;
       if (numSent >= MAX_LEASE_RESEND) break;
     }
     getContext().statManager().addRateData("netDb.republishQuantity", numSent, numSent);
   }
 }