From 79860f017fc6b4f8ef886b6569ab5e4e08e3368d Mon Sep 17 00:00:00 2001 From: zzz Date: Sun, 17 Aug 2025 13:07:17 -0400 Subject: [PATCH] Router: Fix PublishRouterInfoJob sometimes not getting started if setNetDbReady() is called when netDb().isInitialized() is false. This can happen if the router has a few RIs at at startup but not enough and it reseeds, or if reseed is very slow? If PLRIJ does not run then the local RI doesn't get updated and most connections fail due to RI clock skew in the handshake. Then the router is essentially stuck. --- router/java/src/net/i2p/router/Router.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/router/java/src/net/i2p/router/Router.java b/router/java/src/net/i2p/router/Router.java index ead65f51b..8beddda63 100644 --- a/router/java/src/net/i2p/router/Router.java +++ b/router/java/src/net/i2p/router/Router.java @@ -787,7 +787,7 @@ public class Router implements RouterClock.ClockShiftListener { synchronized(_configFileLock) { String f = getConfigFilename(); Properties config = getConfig(_context, f); - // to avoid compiler errror + // to avoid compiler error Map foo = _config; foo.putAll(config); } @@ -956,23 +956,23 @@ public class Router implements RouterClock.ClockShiftListener { changed = true; } } - if (changed && _context.netDb().isInitialized()) { + if (changed) { if (_log.shouldWarn()) - _log.warn("NetDB ready, publishing RI"); + _log.warn("NetDB ready, initialized? " + _context.netDb().isInitialized()); // any previous calls to netdb().publish() did not // actually publish, because netdb init was not complete Republish r = new Republish(_context); // this is called from PersistentDataStore.ReadJob, // so we probably don't need to throw it to the timer queue, // but just to be safe - _context.simpleTimer2().addEvent(r, 0); + long delay = _context.netDb().isInitialized() ? 0 : 60*1000; + _context.simpleTimer2().addEvent(r, delay); // periodically update our RI and republish it to the flooodfills PublishLocalRouterInfoJob plrij = new PublishLocalRouterInfoJob(_context); plrij.getTiming().setStartAfter(_context.clock().now() + plrij.getDelay()); _context.jobQueue().addJob(plrij); - } - if (changed) { + _context.commSystem().initGeoIP(); if (!SystemVersion.isSlow() &&