- Adjust criteria for following DSRM
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
package net.i2p.router.networkdb.kademlia;
|
package net.i2p.router.networkdb.kademlia;
|
||||||
|
|
||||||
import net.i2p.data.Hash;
|
import net.i2p.data.Hash;
|
||||||
|
import net.i2p.data.RouterInfo;
|
||||||
import net.i2p.data.i2np.DatabaseSearchReplyMessage;
|
import net.i2p.data.i2np.DatabaseSearchReplyMessage;
|
||||||
import net.i2p.router.JobImpl;
|
import net.i2p.router.JobImpl;
|
||||||
import net.i2p.router.RouterContext;
|
import net.i2p.router.RouterContext;
|
||||||
@ -10,7 +11,7 @@ import net.i2p.util.Log;
|
|||||||
* Ask the peer who sent us the DSRM for the RouterInfos.
|
* Ask the peer who sent us the DSRM for the RouterInfos.
|
||||||
*
|
*
|
||||||
* If we have the routerInfo already, try to refetch it from that router itself,
|
* If we have the routerInfo already, try to refetch it from that router itself,
|
||||||
* if we aren't already connected to that router,
|
* (if the info is old or we don't think it is floodfill)
|
||||||
* which will help us establish that router as a good floodfill and speed our
|
* which will help us establish that router as a good floodfill and speed our
|
||||||
* integration into the network.
|
* integration into the network.
|
||||||
*
|
*
|
||||||
@ -32,9 +33,13 @@ class SingleLookupJob extends JobImpl {
|
|||||||
Hash peer = _dsrm.getReply(i);
|
Hash peer = _dsrm.getReply(i);
|
||||||
if (peer.equals(getContext().routerHash())) // us
|
if (peer.equals(getContext().routerHash())) // us
|
||||||
continue;
|
continue;
|
||||||
if (getContext().netDb().lookupRouterInfoLocally(peer) == null)
|
if (peer.equals(from)) // wtf
|
||||||
|
continue;
|
||||||
|
RouterInfo ri = getContext().netDb().lookupRouterInfoLocally(peer);
|
||||||
|
if (ri == null)
|
||||||
getContext().jobQueue().addJob(new SingleSearchJob(getContext(), peer, from));
|
getContext().jobQueue().addJob(new SingleSearchJob(getContext(), peer, from));
|
||||||
else if (!getContext().commSystem().isEstablished(peer))
|
else if (ri.getPublished() < getContext().clock().now() - 60*60*1000 ||
|
||||||
|
!FloodfillNetworkDatabaseFacade.isFloodfill(ri))
|
||||||
getContext().jobQueue().addJob(new SingleSearchJob(getContext(), peer, peer));
|
getContext().jobQueue().addJob(new SingleSearchJob(getContext(), peer, peer));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user