2005-09-01 jrandom
* Don't send out a netDb store of a router if it is more than a few hours old, even if someone asked us for it.
This commit is contained in:
@ -1,4 +1,8 @@
|
||||
$Id: history.txt,v 1.232 2005/08/29 20:59:13 jrandom Exp $
|
||||
$Id: history.txt,v 1.233 2005/08/31 19:26:20 jrandom Exp $
|
||||
|
||||
2005-09-01 jrandom
|
||||
* Don't send out a netDb store of a router if it is more than a few hours
|
||||
old, even if someone asked us for it.
|
||||
|
||||
2005-08-31 jrandom
|
||||
* Don't publish leaseSets to the netDb if they will never be looked for -
|
||||
|
@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
|
||||
*
|
||||
*/
|
||||
public class RouterVersion {
|
||||
public final static String ID = "$Revision: 1.221 $ $Date: 2005/08/29 20:59:13 $";
|
||||
public final static String ID = "$Revision: 1.222 $ $Date: 2005/08/31 19:20:17 $";
|
||||
public final static String VERSION = "0.6.0.3";
|
||||
public final static long BUILD = 5;
|
||||
public final static long BUILD = 6;
|
||||
public static void main(String args[]) {
|
||||
System.out.println("I2P Router version: " + VERSION);
|
||||
System.out.println("Router ID: " + RouterVersion.ID);
|
||||
|
@ -44,6 +44,13 @@ public class HandleDatabaseLookupMessageJob extends JobImpl {
|
||||
private final static int REPLY_TIMEOUT = 60*1000;
|
||||
private final static int MESSAGE_PRIORITY = 300;
|
||||
|
||||
/**
|
||||
* If a routerInfo structure isn't updated within an hour, drop it
|
||||
* and search for a later version. This value should be large enough
|
||||
* to deal with the Router.CLOCK_FUDGE_FACTOR.
|
||||
*/
|
||||
public final static long EXPIRE_DELAY = 60*60*1000;
|
||||
|
||||
public HandleDatabaseLookupMessageJob(RouterContext ctx, DatabaseLookupMessage receivedMessage, RouterIdentity from, Hash fromHash) {
|
||||
super(ctx);
|
||||
_log = getContext().logManager().getLog(HandleDatabaseLookupMessageJob.class);
|
||||
@ -101,7 +108,7 @@ public class HandleDatabaseLookupMessageJob extends JobImpl {
|
||||
}
|
||||
} else {
|
||||
RouterInfo info = getContext().netDb().lookupRouterInfoLocally(_message.getSearchKey());
|
||||
if (info != null) {
|
||||
if ( (info != null) && (info.isCurrent(EXPIRE_DELAY)) ) {
|
||||
// send that routerInfo to the _message.getFromHash peer
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("We do have key " + _message.getSearchKey().toBase64()
|
||||
|
@ -39,7 +39,7 @@ class FloodfillPeerSelector extends PeerSelector {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Searching for " + maxNumRouters + " peers close to " + key + ": "
|
||||
+ rv + " (not including " + peersToIgnore + ") [allHashes.size = "
|
||||
+ matches.size() + "]");
|
||||
+ matches.size() + "]", new Exception("Search by"));
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -72,6 +72,8 @@ class FloodfillPeerSelector extends PeerSelector {
|
||||
return;
|
||||
if (entry.equals(_context.routerHash()))
|
||||
return;
|
||||
if (_context.shitlist().isShitlisted(entry))
|
||||
return;
|
||||
RouterInfo info = _context.netDb().lookupRouterInfoLocally(entry);
|
||||
if (info == null)
|
||||
return;
|
||||
|
@ -557,7 +557,7 @@ public class KademliaNetworkDatabaseFacade extends NetworkDatabaseFacade {
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Invalid leaseSet signature! leaseSet = " + leaseSet);
|
||||
return "Invalid leaseSet signature on " + leaseSet.getDestination().calculateHash().toBase64();
|
||||
} else if (leaseSet.getEarliestLeaseDate() <= _context.clock().now() - Router.CLOCK_FUDGE_FACTOR) {
|
||||
} else if (leaseSet.getEarliestLeaseDate() <= _context.clock().now() - 2*Router.CLOCK_FUDGE_FACTOR) {
|
||||
long age = _context.clock().now() - leaseSet.getEarliestLeaseDate();
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Old leaseSet! not storing it: "
|
||||
@ -833,7 +833,7 @@ public class KademliaNetworkDatabaseFacade extends NetworkDatabaseFacade {
|
||||
}
|
||||
|
||||
/** smallest allowed period */
|
||||
private static final int MIN_PER_PEER_TIMEOUT = 2*1000;
|
||||
private static final int MIN_PER_PEER_TIMEOUT = 3*1000;
|
||||
private static final int MAX_PER_PEER_TIMEOUT = 5*1000;
|
||||
|
||||
public int getPeerTimeout(Hash peer) {
|
||||
|
@ -52,7 +52,7 @@ class SearchJob extends JobImpl {
|
||||
private boolean _deferredCleared;
|
||||
private long _startedOn;
|
||||
|
||||
private static final int SEARCH_BREDTH = 3; // 3 peers at a time
|
||||
private static final int SEARCH_BREDTH = 10; // 10 peers at a time
|
||||
private static final int SEARCH_PRIORITY = 400; // large because the search is probably for a real search
|
||||
/** only send the 10 closest "dont tell me about" refs */
|
||||
static final int MAX_CLOSEST = 10;
|
||||
|
Reference in New Issue
Block a user