I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit ddf761b1 authored by zzz's avatar zzz
Browse files

* Streaming: Randomize end of first conn limit period

   to prevent correlation
parent 2814fe75
No related branches found
No related tags found
No related merge requests found
...@@ -4,6 +4,7 @@ import java.util.concurrent.atomic.AtomicInteger; ...@@ -4,6 +4,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import net.i2p.data.Hash; import net.i2p.data.Hash;
import net.i2p.util.ObjectCounter; import net.i2p.util.ObjectCounter;
import net.i2p.util.RandomSource;
import net.i2p.util.SimpleScheduler; import net.i2p.util.SimpleScheduler;
import net.i2p.util.SimpleTimer; import net.i2p.util.SimpleTimer;
...@@ -29,7 +30,12 @@ class ConnThrottler { ...@@ -29,7 +30,12 @@ class ConnThrottler {
_totalMax = totalMax; _totalMax = totalMax;
this.counter = new ObjectCounter<Hash>(); this.counter = new ObjectCounter<Hash>();
_currentTotal = new AtomicInteger(); _currentTotal = new AtomicInteger();
SimpleScheduler.getInstance().addPeriodicEvent(new Cleaner(), period); // shorten the initial period by a random amount,mpleScheduler.getInstance().addPeriodicEvent(new Cleaner(),
// to prevent correlation across destinations
// and identification of router startup time
SimpleScheduler.getInstance().addPeriodicEvent(new Cleaner(),
RandomSource.getInstance().nextLong(period),
period);
} }
/* /*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment