From a7e876da1edff8da76465d4c6be5ef18a56ba53a Mon Sep 17 00:00:00 2001 From: zzz <zzz@mail.i2p> Date: Sun, 19 Oct 2008 21:48:55 +0000 Subject: [PATCH] * FloodfillMonitor: - Don't become ff if clock skew is high - Rebuild routerinfo immediately when ff status changes --- .../i2p/router/networkdb/kademlia/FloodfillMonitorJob.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/router/java/src/net/i2p/router/networkdb/kademlia/FloodfillMonitorJob.java b/router/java/src/net/i2p/router/networkdb/kademlia/FloodfillMonitorJob.java index 8a55718195..ec44d35d66 100644 --- a/router/java/src/net/i2p/router/networkdb/kademlia/FloodfillMonitorJob.java +++ b/router/java/src/net/i2p/router/networkdb/kademlia/FloodfillMonitorJob.java @@ -39,8 +39,11 @@ class FloodfillMonitorJob extends JobImpl { public String getName() { return "Monitor the floodfill pool"; } public void runJob() { + boolean wasFF = _facade.floodfillEnabled(); boolean ff = shouldBeFloodfill(); _facade.setFloodfillEnabled(ff); + if (ff != wasFF) + getContext().router().rebuildRouterInfo(); if (_log.shouldLog(Log.INFO)) _log.info("Should we be floodfill? " + ff); requeue((REQUEUE_DELAY / 2) + getContext().random().nextInt(REQUEUE_DELAY)); @@ -115,6 +118,7 @@ class FloodfillMonitorJob extends JobImpl { happy = happy && _facade.getKnownRouters() >= 200; happy = happy && getContext().commSystem().countActivePeers() >= 50; happy = happy && getContext().tunnelManager().getParticipatingCount() >= 100; + happy = happy && Math.abs(getContext().clock().getOffset()) < 10*1000; // We need an address and no introducers if (happy) { RouterAddress ra = getContext().router().getRouterInfo().getTargetAddress("SSU"); -- GitLab