From 57eb706e95798c8da7ed2d864ec442edbef4ff70 Mon Sep 17 00:00:00 2001 From: idk Date: Tue, 7 Nov 2023 21:07:18 +0000 Subject: [PATCH] I2p.i2p.2.4.0 reverse throttler --- .../kademlia/FloodfillDatabaseLookupMessageHandler.java | 3 +-- .../kademlia/FloodfillNetworkDatabaseFacade.java | 9 --------- .../i2p/router/networkdb/kademlia/LookupThrottler.java | 4 ++-- 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/router/java/src/net/i2p/router/networkdb/kademlia/FloodfillDatabaseLookupMessageHandler.java b/router/java/src/net/i2p/router/networkdb/kademlia/FloodfillDatabaseLookupMessageHandler.java index 20a6b49029..606f3e97ac 100644 --- a/router/java/src/net/i2p/router/networkdb/kademlia/FloodfillDatabaseLookupMessageHandler.java +++ b/router/java/src/net/i2p/router/networkdb/kademlia/FloodfillDatabaseLookupMessageHandler.java @@ -83,8 +83,7 @@ public Job createJob(I2NPMessage receivedMessage, RouterIdentity from, Hash from _context.statManager().addRateData("netDb.nonFFLookupsDropped", 1); return null; } - if ((!_facade.shouldThrottleLookup(dlm.getFrom(), dlm.getReplyTunnel()) - && !_facade.shouldThrottleBurstLookup(dlm.getFrom(), dlm.getReplyTunnel())) + if (!_facade.shouldThrottleLookup(dlm.getFrom(), dlm.getReplyTunnel()) || _context.routerHash().equals(dlm.getFrom())) { Job j = new HandleFloodfillDatabaseLookupMessageJob(_context, dlm, from, fromHash, _msgIDBloomXor); // if (false) { diff --git a/router/java/src/net/i2p/router/networkdb/kademlia/FloodfillNetworkDatabaseFacade.java b/router/java/src/net/i2p/router/networkdb/kademlia/FloodfillNetworkDatabaseFacade.java index 1f220a3550..395ee0ac34 100644 --- a/router/java/src/net/i2p/router/networkdb/kademlia/FloodfillNetworkDatabaseFacade.java +++ b/router/java/src/net/i2p/router/networkdb/kademlia/FloodfillNetworkDatabaseFacade.java @@ -41,10 +41,7 @@ public class FloodfillNetworkDatabaseFacade extends KademliaNetworkDatabaseFacad private final Set _verifiesInProgress; private FloodThrottler _floodThrottler; private LookupThrottler _lookupThrottler; - private LookupThrottler _lookupThrottlerBurst; private final Job _ffMonitor; - private final int DROP_LOOKUP_BURST = 10; - private final int DROP_LOOKUP_BURST_INTERVAL = 30*1000; /** * This is the flood redundancy. Entries are @@ -112,7 +109,6 @@ public synchronized void startup() { } else { isFF = _context.getBooleanProperty(FloodfillMonitorJob.PROP_FLOODFILL_PARTICIPANT); _lookupThrottler = new LookupThrottler(); - _lookupThrottlerBurst = new LookupThrottler(DROP_LOOKUP_BURST, DROP_LOOKUP_BURST_INTERVAL); } long down = _context.router().getEstimatedDowntime(); @@ -240,11 +236,6 @@ boolean shouldThrottleLookup(Hash from, TunnelId id) { return _lookupThrottler == null || _lookupThrottler.shouldThrottle(from, id); } - boolean shouldThrottleBurstLookup(Hash from, TunnelId id) { - // null before startup - return _lookupThrottlerBurst == null || _lookupThrottlerBurst.shouldThrottle(from, id); - } - /** * If we are floodfill AND the key is not throttled, * flood it, otherwise don't. diff --git a/router/java/src/net/i2p/router/networkdb/kademlia/LookupThrottler.java b/router/java/src/net/i2p/router/networkdb/kademlia/LookupThrottler.java index 306a96a77a..9d43c78c78 100644 --- a/router/java/src/net/i2p/router/networkdb/kademlia/LookupThrottler.java +++ b/router/java/src/net/i2p/router/networkdb/kademlia/LookupThrottler.java @@ -23,8 +23,8 @@ class LookupThrottler { private final int MAX_LOOKUPS; // DEFAULT=20 private final long CLEAN_TIME; // DEFAULT=3*60*1000 LookupThrottler() { - MAX_LOOKUPS = 20; - CLEAN_TIME = 3*60*1000; + MAX_LOOKUPS = 14; + CLEAN_TIME = 2*60*1000; this.counter = new ObjectCounter(); SimpleTimer2.getInstance().addPeriodicEvent(new Cleaner(), CLEAN_TIME); }