forked from I2P_Developers/i2p.i2p
- Move reseeding from the routerconsole app to
the router, so that we can bootstrap an embedded router lacking a routerconsole
(iMule or android for example), without additional modifications.
This allows better integration between the reseeding function
and the netDb.
- Call reseed from PersistentDataStore, not from the
routerconsole init, and start seeding as soon as the netdb has read
the netDb/ directory, not when the console starts.
- Wake up the netdb reader as soon as reseeding is done,
rather than waiting up to 60s.
- Don't display the reseed button on the console until the
netdb initialization is done.
* NetDb:
- Fix an NPE on early shutdown
* RouterConsoleRunner:
- Catch a class not found error better
35 lines
967 B
Java
35 lines
967 B
Java
package net.i2p.router.web;
|
|
|
|
import net.i2p.router.RouterContext;
|
|
import net.i2p.router.networkdb.reseed.Reseeder;
|
|
|
|
/**
|
|
* Handler to deal with reseed requests.
|
|
*/
|
|
public class ReseedHandler extends HelperBase {
|
|
private static Reseeder _reseedRunner;
|
|
|
|
public ReseedHandler() {
|
|
this(ContextHelper.getContext(null));
|
|
}
|
|
public ReseedHandler(RouterContext ctx) {
|
|
_context = ctx;
|
|
}
|
|
|
|
public void setReseedNonce(String nonce) {
|
|
if (nonce == null) return;
|
|
if (nonce.equals(System.getProperty("net.i2p.router.web.ReseedHandler.nonce")) ||
|
|
nonce.equals(System.getProperty("net.i2p.router.web.ReseedHandler.noncePrev"))) {
|
|
requestReseed();
|
|
}
|
|
}
|
|
|
|
public void requestReseed() {
|
|
synchronized (ReseedHandler.class) {
|
|
if (_reseedRunner == null)
|
|
_reseedRunner = new Reseeder(_context);
|
|
_reseedRunner.requestReseed();
|
|
}
|
|
}
|
|
}
|