Package net.i2p.i2ptunnel
Class ConnThrottler
java.lang.Object
net.i2p.i2ptunnel.ConnThrottler
Count how often something happens with a particular peer and all peers.
This offers basic DOS protection but is not a complete solution.
This is a little different from the one in streaming, in that the
ban time is different from the check time, and we keep a separate
map of throttled peers with individual time stamps.
The streaming version is lightweight but "sloppy" since it
uses a single time bucket for all.
- Since:
- 0.9.9
-
Constructor Summary
ConstructorDescriptionConnThrottler
(int max, int totalMax, long period, long throttlePeriod, long totalThrottlePeriod, String action, Log log) -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
start overboolean
Checks both individual and total.void
start()
void
stop()
void
updateLimits
(int max, int totalMax, long checkPeriod, long throttlePeriod, long totalThrottlePeriod)
-
Constructor Details
-
ConnThrottler
-
-
Method Details
-
start
public void start() -
stop
public void stop() -
updateLimits
public void updateLimits(int max, int totalMax, long checkPeriod, long throttlePeriod, long totalThrottlePeriod) -
shouldThrottle
Checks both individual and total. Increments before checking. -
clear
public void clear()start over
-