I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Unverified Commit 981946c9 authored by zzz's avatar zzz
Browse files

NetDB: Don't explore if we have enough RIs

parent 84e70ba0
No related branches found
No related tags found
No related merge requests found
...@@ -17,6 +17,7 @@ import net.i2p.router.JobImpl; ...@@ -17,6 +17,7 @@ import net.i2p.router.JobImpl;
import net.i2p.router.Router; import net.i2p.router.Router;
import net.i2p.router.RouterContext; import net.i2p.router.RouterContext;
import net.i2p.util.Log; import net.i2p.util.Log;
import net.i2p.util.SystemVersion;
/** /**
* Fire off search jobs for random keys from the explore pool, up to MAX_PER_RUN * Fire off search jobs for random keys from the explore pool, up to MAX_PER_RUN
...@@ -48,6 +49,9 @@ class StartExplorersJob extends JobImpl { ...@@ -48,6 +49,9 @@ class StartExplorersJob extends JobImpl {
private static final int LOW_ROUTERS = 2 * MIN_ROUTERS; private static final int LOW_ROUTERS = 2 * MIN_ROUTERS;
/** explore slowly if we have more than this many routers */ /** explore slowly if we have more than this many routers */
private static final int MAX_ROUTERS = 2 * LOW_ROUTERS; private static final int MAX_ROUTERS = 2 * LOW_ROUTERS;
// must be lower than LIMIT_ROUTERS in HandleFloodfillDatabaseStoreMessageJob
// because exploration does not register a reply job
private static final int LIMIT_ROUTERS = SystemVersion.isSlow() ? 800 : 3000;
private static final int MIN_FFS = 50; private static final int MIN_FFS = 50;
static final int LOW_FFS = 2 * MIN_FFS; static final int LOW_FFS = 2 * MIN_FFS;
...@@ -63,13 +67,13 @@ class StartExplorersJob extends JobImpl { ...@@ -63,13 +67,13 @@ class StartExplorersJob extends JobImpl {
public String getName() { return "Start Explorers Job"; } public String getName() { return "Start Explorers Job"; }
public void runJob() { public void runJob() {
int count = _facade.getDataStore().size();
if (! (_facade.floodfillEnabled() || if (! (_facade.floodfillEnabled() ||
count > LIMIT_ROUTERS ||
getContext().jobQueue().getMaxLag() > MAX_LAG || getContext().jobQueue().getMaxLag() > MAX_LAG ||
getContext().throttle().getMessageDelay() > MAX_MSG_DELAY || getContext().throttle().getMessageDelay() > MAX_MSG_DELAY ||
// message delay limit also?
getContext().router().gracefulShutdownInProgress())) { getContext().router().gracefulShutdownInProgress())) {
int num = MAX_PER_RUN; int num = MAX_PER_RUN;
int count = _facade.getDataStore().size();
if (count < MIN_ROUTERS) if (count < MIN_ROUTERS)
num *= 15; // at less than 3x MIN_RESEED, explore extremely aggressively num *= 15; // at less than 3x MIN_RESEED, explore extremely aggressively
else if (count < LOW_ROUTERS) else if (count < LOW_ROUTERS)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment