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

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

Profiles: Make DBHistory rates final

parent f2b206b1
No related branches found
No related tags found
No related merge requests found
...@@ -18,8 +18,8 @@ public class DBHistory { ...@@ -18,8 +18,8 @@ public class DBHistory {
private final RouterContext _context; private final RouterContext _context;
//private long _successfulLookups; //private long _successfulLookups;
//private long _failedLookups; //private long _failedLookups;
private RateStat _failedLookupRate; private final RateStat _failedLookupRate;
private RateStat _invalidReplyRate; private final RateStat _invalidReplyRate;
//private long _lookupReplyNew; //private long _lookupReplyNew;
//private long _lookupReplyOld; //private long _lookupReplyOld;
//private long _lookupReplyDuplicate; //private long _lookupReplyDuplicate;
...@@ -40,7 +40,8 @@ public class DBHistory { ...@@ -40,7 +40,8 @@ public class DBHistory {
_log = context.logManager().getLog(DBHistory.class); _log = context.logManager().getLog(DBHistory.class);
_statGroup = statGroup; _statGroup = statGroup;
//_lastLookupReceived = -1; //_lastLookupReceived = -1;
createRates(statGroup); _failedLookupRate = new RateStat("dbHistory.failedLookupRate", "How often does this peer to respond to a lookup?", statGroup, new long[] { 10*60*1000l, 60*60*1000l, 24*60*60*1000l });
_invalidReplyRate = new RateStat("dbHistory.invalidReplyRate", "How often does this peer give us a bad (nonexistant, forged, etc) peer?", statGroup, new long[] { 30*60*1000l });
} }
/** how many times we have sent them a db lookup and received the value back from them /** how many times we have sent them a db lookup and received the value back from them
...@@ -315,18 +316,10 @@ public class DBHistory { ...@@ -315,18 +316,10 @@ public class DBHistory {
try { try {
_invalidReplyRate.load(props, "dbHistory.invalidReplyRate", true); _invalidReplyRate.load(props, "dbHistory.invalidReplyRate", true);
} catch (IllegalArgumentException iae) { } catch (IllegalArgumentException iae) {
_log.warn("DB History invalid reply rate is corrupt, resetting", iae); _log.warn("DB History invalid reply rate is corrupt", iae);
createRates(_statGroup);
} }
} }
private synchronized void createRates(String statGroup) {
if (_failedLookupRate == null)
_failedLookupRate = new RateStat("dbHistory.failedLookupRate", "How often does this peer to respond to a lookup?", statGroup, new long[] { 10*60*1000l, 60*60*1000l, 24*60*60*1000l });
if (_invalidReplyRate == null)
_invalidReplyRate = new RateStat("dbHistory.invalidReplyRate", "How often does this peer give us a bad (nonexistant, forged, etc) peer?", statGroup, new long[] { 30*60*1000l });
}
private final static long getLong(Properties props, String key) { private final static long getLong(Properties props, String key) {
return ProfilePersistenceHelper.getLong(props, key); return ProfilePersistenceHelper.getLong(props, key);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment