From eeeeef81cfecd6d91fbca779a3ef2ef033395d52 Mon Sep 17 00:00:00 2001 From: zzz Date: Wed, 7 Jan 2015 19:16:55 +0000 Subject: [PATCH] NetDB: Possible fixes for reseed completion not recognized (ticket #1384) --- history.txt | 4 +++- router/java/src/net/i2p/router/RouterVersion.java | 2 +- .../networkdb/kademlia/PersistentDataStore.java | 12 +++++++----- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/history.txt b/history.txt index 61284c2651..3b3887971b 100644 --- a/history.txt +++ b/history.txt @@ -1,6 +1,8 @@ 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 + * Startup: Accept tunnels after 10 minutes instead of 20 (ticket #1152) * Tunnels: Cleanup, catch more cases of zero-hop configuration 2015-01-05 zzz diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index fecba78d69..a6204817e3 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -18,7 +18,7 @@ public class RouterVersion { /** deprecated */ public final static String ID = "Monotone"; public final static String VERSION = CoreVersion.VERSION; - public final static long BUILD = 7; + public final static long BUILD = 8; /** for example "-test" */ public final static String EXTRA = ""; diff --git a/router/java/src/net/i2p/router/networkdb/kademlia/PersistentDataStore.java b/router/java/src/net/i2p/router/networkdb/kademlia/PersistentDataStore.java index 17b516cac5..3fe88f5e6e 100644 --- a/router/java/src/net/i2p/router/networkdb/kademlia/PersistentDataStore.java +++ b/router/java/src/net/i2p/router/networkdb/kademlia/PersistentDataStore.java @@ -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, * 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. * As of 0.9.4, also initiates an automatic reseed if necessary. */ private class ReadJob extends JobImpl { - private long _lastModified; - private long _lastReseed; + private volatile long _lastModified; + private volatile long _lastReseed; private static final int MIN_ROUTERS = KademliaNetworkDatabaseFacade.MIN_RESEED; private static final long MIN_RESEED_INTERVAL = 90*60*1000; @@ -362,11 +364,11 @@ class PersistentDataStore extends TransientDataStore { } if (shouldScan) { _log.info("Rereading new files"); + _lastModified = now; // synch with the writer job synchronized (_dbDir) { readFiles(); } - _lastModified = now; } requeue(READ_DELAY); } @@ -429,13 +431,13 @@ class PersistentDataStore extends TransientDataStore { } if (!_initialized) { + _initialized = true; if (_facade.reseedChecker().checkReseed(routerCount)) { _lastReseed = _context.clock().now(); // checkReseed will call wakeup() when done and we will run again } else { _context.router().setNetDbReady(); } - _initialized = true; } else if (_lastReseed < _context.clock().now() - MIN_RESEED_INTERVAL) { int count = Math.min(routerCount, size()); if (count < MIN_ROUTERS) {