NetDB: Possible fixes for reseed completion not recognized (ticket #1384)

This commit is contained in:
zzz
2015-01-07 19:16:55 +00:00
parent bcb9fe5f24
commit eeeeef81cf
3 changed files with 11 additions and 7 deletions

View File

@@ -1,6 +1,8 @@
2015-01-07 zzz 2015-01-07 zzz
* ClientAppConfig: Start i2ptunnel sooner * ClientAppConfig: Start i2ptunnel sooner (ticket #1162)
* NetDB: Possible fixes for reseed completion not recognized (ticket #1384)
* Router: Add startup/shutdown state machine * Router: Add startup/shutdown state machine
* Startup: Accept tunnels after 10 minutes instead of 20 (ticket #1152)
* Tunnels: Cleanup, catch more cases of zero-hop configuration * Tunnels: Cleanup, catch more cases of zero-hop configuration
2015-01-05 zzz 2015-01-05 zzz

View File

@@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */ /** deprecated */
public final static String ID = "Monotone"; public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION; public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 7; public final static long BUILD = 8;
/** for example "-test" */ /** for example "-test" */
public final static String EXTRA = ""; public final static String EXTRA = "";

View File

@@ -327,15 +327,17 @@ class PersistentDataStore extends TransientDataStore {
} }
/** /**
* This is mostly for manual reseeding, i.e. the user manually * This was mostly for manual reseeding, i.e. the user manually
* copies RI files to the directory. Nobody does this, * copies RI files to the directory. Nobody does this,
* so this is run way too often. * so this is run way too often.
*
* But it's also for migrating and reading the files after a reseed.
* Reseed task calls wakeup() on completion. * Reseed task calls wakeup() on completion.
* As of 0.9.4, also initiates an automatic reseed if necessary. * As of 0.9.4, also initiates an automatic reseed if necessary.
*/ */
private class ReadJob extends JobImpl { private class ReadJob extends JobImpl {
private long _lastModified; private volatile long _lastModified;
private long _lastReseed; private volatile long _lastReseed;
private static final int MIN_ROUTERS = KademliaNetworkDatabaseFacade.MIN_RESEED; private static final int MIN_ROUTERS = KademliaNetworkDatabaseFacade.MIN_RESEED;
private static final long MIN_RESEED_INTERVAL = 90*60*1000; private static final long MIN_RESEED_INTERVAL = 90*60*1000;
@@ -362,11 +364,11 @@ class PersistentDataStore extends TransientDataStore {
} }
if (shouldScan) { if (shouldScan) {
_log.info("Rereading new files"); _log.info("Rereading new files");
_lastModified = now;
// synch with the writer job // synch with the writer job
synchronized (_dbDir) { synchronized (_dbDir) {
readFiles(); readFiles();
} }
_lastModified = now;
} }
requeue(READ_DELAY); requeue(READ_DELAY);
} }
@@ -429,13 +431,13 @@ class PersistentDataStore extends TransientDataStore {
} }
if (!_initialized) { if (!_initialized) {
_initialized = true;
if (_facade.reseedChecker().checkReseed(routerCount)) { if (_facade.reseedChecker().checkReseed(routerCount)) {
_lastReseed = _context.clock().now(); _lastReseed = _context.clock().now();
// checkReseed will call wakeup() when done and we will run again // checkReseed will call wakeup() when done and we will run again
} else { } else {
_context.router().setNetDbReady(); _context.router().setNetDbReady();
} }
_initialized = true;
} else if (_lastReseed < _context.clock().now() - MIN_RESEED_INTERVAL) { } else if (_lastReseed < _context.clock().now() - MIN_RESEED_INTERVAL) {
int count = Math.min(routerCount, size()); int count = Math.min(routerCount, size());
if (count < MIN_ROUTERS) { if (count < MIN_ROUTERS) {