use of net.i2p.data.DatabaseEntry in project i2p.i2p by i2p.
the class SearchJob method resend.
/**
* 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 {
// _state.getFailed();
Set<Hash> sendTo = _state.getRepliedPeers();
sendTo.addAll(_state.getPending());
int numSent = 0;
for (Hash peer : sendTo) {
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);
}
}
Aggregations