Reseed: Don't reseed while shutting down (ticket #1565)

This commit is contained in:
zzz
2015-05-08 12:27:40 +00:00
parent 31cfddc218
commit 5dc7497802
3 changed files with 17 additions and 0 deletions

View File

@@ -348,6 +348,12 @@ class PersistentDataStore extends TransientDataStore {
public String getName() { return "DB Read Job"; }
public void runJob() {
if (getContext().router().gracefulShutdownInProgress()) {
// don't cause more disk I/O while saving,
// or start a reseed
requeue(READ_DELAY);
return;
}
long now = getContext().clock().now();
// check directory mod time to save a lot of object churn in scanning all the file names
long lastMod = _dbDir.lastModified();

View File

@@ -63,6 +63,13 @@ public class ReseedChecker {
return false;
}
if (_context.router().gracefulShutdownInProgress()) {
String s = "Only " + count + " peers remaining but reseed disabled by shutdown in progress";
_lastError = s;
_log.logAlways(Log.WARN, s);
return false;
}
// we check the i2p installation directory for a flag telling us not to reseed,
// but also check the home directory for that flag too, since new users installing i2p
// don't have an installation directory that they can put the flag in yet.

View File

@@ -504,6 +504,10 @@ public class Reseeder {
private int reseed(List<URL> URLList, boolean echoStatus) {
int total = 0;
for (int i = 0; i < URLList.size() && _isRunning; i++) {
if (_context.router().gracefulShutdownInProgress()) {
System.out.println("Reseed aborted, shutdown in progress");
return total;
}
URL url = URLList.get(i);
int dl = 0;
if (ENABLE_SU3) {