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

Skip to content
Snippets Groups Projects

add user-configurable expire-time to blocklists.

Merged idk requested to merge idk/i2p.i2p:i2p.i2p.2.2.1-blocklist-expiration into master
1 file
+ 9
5
Compare changes
  • Side-by-side
  • Inline
@@ -154,21 +154,25 @@ public class Blocklist {
private int expireInterval(){
String expireIntervalValue = _context.getProperty(PROP_BLOCKLIST_EXPIRE_INTERVAL, "0");
try{
Integer expireIntervalInt = 0;
if (expireIntervalValue.endsWith("s")) {
expireIntervalValue = expireIntervalValue.substring(0, expireIntervalValue.length() - 1);
return Integer.parseInt(expireIntervalValue) * 1000;
expireIntervalInt = Integer.parseInt(expireIntervalValue) * 1000;
}else if(expireIntervalValue.endsWith("m")){
expireIntervalValue = expireIntervalValue.substring(0, expireIntervalValue.length() - 1);
return Integer.parseInt(expireIntervalValue) * 60000;
expireIntervalInt = Integer.parseInt(expireIntervalValue) * 60000;
}else if(expireIntervalValue.endsWith("h")){
expireIntervalValue = expireIntervalValue.substring(0, expireIntervalValue.length() - 1);
return Integer.parseInt(expireIntervalValue) * 3600000;
expireIntervalInt = Integer.parseInt(expireIntervalValue) * 3600000;
}else if (expireIntervalValue.endsWith("d")) {
expireIntervalValue = expireIntervalValue.substring(0, expireIntervalValue.length() - 1);
return Integer.parseInt(expireIntervalValue) * 86400000;
expireIntervalInt = Integer.parseInt(expireIntervalValue) * 86400000;
}else{
return Integer.parseInt(expireIntervalValue);
expireIntervalInt = Integer.parseInt(expireIntervalValue);
}
if (expireIntervalInt < 0)
expireIntervalInt = 0;
return expireIntervalInt;
}catch(NumberFormatException nfe){
if (_log.shouldLog(_log.ERROR))
_log.error("format error in "+PROP_BLOCKLIST_EXPIRE_INTERVAL, nfe);
Loading