forked from I2P_Developers/i2p.i2p
Compare commits
1 Commits
i2p-2.5.2-
...
i2p.i2p.2.
Author | SHA1 | Date | |
---|---|---|---|
997c49a03a |
@ -28,11 +28,11 @@ import net.i2p.util.Log;
|
||||
*/
|
||||
class ExpireLeasesJob extends JobImpl {
|
||||
private final Log _log;
|
||||
private final KademliaNetworkDatabaseFacade _facade;
|
||||
private final KademliaNetworkDatabaseContext _facade;
|
||||
|
||||
private final static long RERUN_DELAY_MS = 1*60*1000;
|
||||
|
||||
public ExpireLeasesJob(RouterContext ctx, KademliaNetworkDatabaseFacade facade) {
|
||||
public ExpireLeasesJob(RouterContext ctx, KademliaNetworkDatabaseContext facade) {
|
||||
super(ctx);
|
||||
_log = ctx.logManager().getLog(ExpireLeasesJob.class);
|
||||
_facade = facade;
|
||||
|
@ -32,13 +32,13 @@ import net.i2p.util.SystemVersion;
|
||||
*/
|
||||
class ExpireRoutersJob extends JobImpl {
|
||||
private final Log _log;
|
||||
private final KademliaNetworkDatabaseFacade _facade;
|
||||
private final KademliaNetworkDatabaseContext _facade;
|
||||
|
||||
/** rerun fairly often, so the fails don't queue up too many netdb searches at once */
|
||||
private final static long RERUN_DELAY_MS = 5*60*1000;
|
||||
private static final int LIMIT_ROUTERS = SystemVersion.isSlow() ? 1000 : 4000;
|
||||
|
||||
public ExpireRoutersJob(RouterContext ctx, KademliaNetworkDatabaseFacade facade) {
|
||||
public ExpireRoutersJob(RouterContext ctx, KademliaNetworkDatabaseContext facade) {
|
||||
super(ctx);
|
||||
_log = ctx.logManager().getLog(ExpireRoutersJob.class);
|
||||
_facade = facade;
|
||||
|
@ -56,7 +56,7 @@ class ExploreJob extends SearchJob {
|
||||
* @param isRealExplore if true, a standard exploration (no floodfills will be returned)
|
||||
* if false, a standard lookup (floodfills will be returned, use if low on floodfills)
|
||||
*/
|
||||
public ExploreJob(RouterContext context, KademliaNetworkDatabaseFacade facade, Hash key, boolean isRealExplore, long msgIDBloomXor) {
|
||||
public ExploreJob(RouterContext context, KademliaNetworkDatabaseContext facade, Hash key, boolean isRealExplore, long msgIDBloomXor) {
|
||||
// note that we're treating the last param (isLease) as *false* since we're just exploring.
|
||||
// if this collides with an actual leaseSet's key, neat, but that wouldn't imply we're actually
|
||||
// attempting to send that lease a message!
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -53,7 +53,7 @@ import net.i2p.util.SystemVersion;
|
||||
*/
|
||||
public class PersistentDataStore extends TransientDataStore {
|
||||
private final File _dbDir;
|
||||
private final KademliaNetworkDatabaseFacade _facade;
|
||||
private final KademliaNetworkDatabaseContext _facade;
|
||||
private final Writer _writer;
|
||||
private final ReadJob _readJob;
|
||||
private volatile boolean _initialized;
|
||||
@ -69,7 +69,7 @@ public class PersistentDataStore extends TransientDataStore {
|
||||
/**
|
||||
* @param dbDir relative path
|
||||
*/
|
||||
public PersistentDataStore(RouterContext ctx, String dbDir, KademliaNetworkDatabaseFacade facade) throws IOException {
|
||||
public PersistentDataStore(RouterContext ctx, String dbDir, KademliaNetworkDatabaseContext facade) throws IOException {
|
||||
super(ctx);
|
||||
_networkID = ctx.router().getNetworkID();
|
||||
_flat = ctx.getBooleanProperty(PROP_FLAT);
|
||||
@ -351,7 +351,7 @@ public class PersistentDataStore extends TransientDataStore {
|
||||
private volatile long _lastModified;
|
||||
private volatile long _lastReseed;
|
||||
private volatile boolean _setNetDbReady;
|
||||
private static final int MIN_ROUTERS = KademliaNetworkDatabaseFacade.MIN_RESEED;
|
||||
private static final int MIN_ROUTERS = KademliaNetworkDatabaseContext.MIN_RESEED;
|
||||
private static final long MIN_RESEED_INTERVAL = 90*60*1000;
|
||||
|
||||
public ReadJob() {
|
||||
@ -698,7 +698,7 @@ public class PersistentDataStore extends TransientDataStore {
|
||||
*/
|
||||
public static File getRouterInfoFile(RouterContext ctx, Hash hash) {
|
||||
String b64 = hash.toBase64();
|
||||
File dir = new File(ctx.getRouterDir(), ctx.getProperty(KademliaNetworkDatabaseFacade.PROP_DB_DIR, KademliaNetworkDatabaseFacade.DEFAULT_DB_DIR));
|
||||
File dir = new File(ctx.getRouterDir(), ctx.getProperty(KademliaNetworkDatabaseContext.PROP_DB_DIR, KademliaNetworkDatabaseContext.DEFAULT_DB_DIR));
|
||||
if (ctx.getBooleanProperty(PROP_FLAT))
|
||||
return new File(dir, ROUTERINFO_PREFIX + b64 + ROUTERINFO_SUFFIX);
|
||||
return new File(dir, DIR_PREFIX + b64.charAt(0) + File.separatorChar + ROUTERINFO_PREFIX + b64 + ROUTERINFO_SUFFIX);
|
||||
|
@ -25,11 +25,11 @@ class RepublishLeaseSetJob extends JobImpl {
|
||||
public final static long REPUBLISH_LEASESET_TIMEOUT = 60*1000;
|
||||
private final static int RETRY_DELAY = 20*1000;
|
||||
private final Hash _dest;
|
||||
private final KademliaNetworkDatabaseFacade _facade;
|
||||
private final KademliaNetworkDatabaseContext _facade;
|
||||
/** this is actually last attempted publish */
|
||||
private long _lastPublished;
|
||||
|
||||
public RepublishLeaseSetJob(RouterContext ctx, KademliaNetworkDatabaseFacade facade, Hash destHash) {
|
||||
public RepublishLeaseSetJob(RouterContext ctx, KademliaNetworkDatabaseContext facade, Hash destHash) {
|
||||
super(ctx);
|
||||
_log = ctx.logManager().getLog(RepublishLeaseSetJob.class);
|
||||
_facade = facade;
|
||||
|
@ -41,7 +41,7 @@ import net.i2p.util.Log;
|
||||
*/
|
||||
class SearchJob extends JobImpl {
|
||||
protected final Log _log;
|
||||
protected final KademliaNetworkDatabaseFacade _facade;
|
||||
protected final KademliaNetworkDatabaseContext _facade;
|
||||
private final SearchState _state;
|
||||
private final Job _onSuccess;
|
||||
private final Job _onFailure;
|
||||
@ -91,7 +91,7 @@ class SearchJob extends JobImpl {
|
||||
* Create a new search for the routingKey specified
|
||||
*
|
||||
*/
|
||||
public SearchJob(RouterContext context, KademliaNetworkDatabaseFacade facade, Hash key,
|
||||
public SearchJob(RouterContext context, KademliaNetworkDatabaseContext facade, Hash key,
|
||||
Job onSuccess, Job onFailure, long timeoutMs, boolean keepStats, boolean isLease, long msgIDBloomXor) {
|
||||
super(context);
|
||||
if ( (key == null) || (key.getData() == null) )
|
||||
@ -123,7 +123,7 @@ class SearchJob extends JobImpl {
|
||||
}
|
||||
|
||||
protected SearchState getState() { return _state; }
|
||||
protected KademliaNetworkDatabaseFacade getFacade() { return _facade; }
|
||||
protected KademliaNetworkDatabaseContext getFacade() { return _facade; }
|
||||
public long getExpiration() { return _expiration; }
|
||||
public long getTimeoutMs() { return _timeoutMs; }
|
||||
|
||||
|
@ -25,7 +25,7 @@ class SearchUpdateReplyFoundJob extends JobImpl implements ReplyJob {
|
||||
private I2NPMessage _message;
|
||||
private final Hash _peer;
|
||||
private final SearchState _state;
|
||||
private final KademliaNetworkDatabaseFacade _facade;
|
||||
private final KademliaNetworkDatabaseContext _facade;
|
||||
private final SearchJob _job;
|
||||
private final TunnelInfo _outTunnel;
|
||||
private final TunnelInfo _replyTunnel;
|
||||
@ -33,13 +33,13 @@ class SearchUpdateReplyFoundJob extends JobImpl implements ReplyJob {
|
||||
private final long _sentOn;
|
||||
|
||||
public SearchUpdateReplyFoundJob(RouterContext context, RouterInfo peer,
|
||||
SearchState state, KademliaNetworkDatabaseFacade facade,
|
||||
SearchState state, KademliaNetworkDatabaseContext facade,
|
||||
SearchJob job) {
|
||||
this(context, peer, state, facade, job, null, null);
|
||||
}
|
||||
|
||||
public SearchUpdateReplyFoundJob(RouterContext context, RouterInfo peer,
|
||||
SearchState state, KademliaNetworkDatabaseFacade facade,
|
||||
SearchState state, KademliaNetworkDatabaseContext facade,
|
||||
SearchJob job, TunnelInfo outTunnel, TunnelInfo replyTunnel) {
|
||||
super(context);
|
||||
_log = context.logManager().getLog(SearchUpdateReplyFoundJob.class);
|
||||
|
@ -31,7 +31,7 @@ import net.i2p.util.SystemVersion;
|
||||
*/
|
||||
class StartExplorersJob extends JobImpl {
|
||||
private final Log _log;
|
||||
private final KademliaNetworkDatabaseFacade _facade;
|
||||
private final KademliaNetworkDatabaseContext _facade;
|
||||
|
||||
/** don't explore more than 1 bucket at a time */
|
||||
private static final int MAX_PER_RUN = 1;
|
||||
@ -45,7 +45,7 @@ class StartExplorersJob extends JobImpl {
|
||||
The goal here is to avoid reseeding.
|
||||
*/
|
||||
/** very aggressively explore if we have less than this many routers */
|
||||
private static final int MIN_ROUTERS = 3 * KademliaNetworkDatabaseFacade.MIN_RESEED;
|
||||
private static final int MIN_ROUTERS = 3 * KademliaNetworkDatabaseContext.MIN_RESEED;
|
||||
/** aggressively explore if we have less than this many routers */
|
||||
private static final int LOW_ROUTERS = 2 * MIN_ROUTERS;
|
||||
/** explore slowly if we have more than this many routers */
|
||||
@ -61,7 +61,7 @@ class StartExplorersJob extends JobImpl {
|
||||
|
||||
private final long _msgIDBloomXor = RandomSource.getInstance().nextLong();
|
||||
|
||||
public StartExplorersJob(RouterContext context, KademliaNetworkDatabaseFacade facade) {
|
||||
public StartExplorersJob(RouterContext context, KademliaNetworkDatabaseContext facade) {
|
||||
super(context);
|
||||
_log = context.logManager().getLog(StartExplorersJob.class);
|
||||
_facade = facade;
|
||||
|
Reference in New Issue
Block a user