Fix netdb.knownLeaseSets count reported by floodfill routers

This commit is contained in:
zzz
2008-03-01 16:13:41 +00:00
parent a7397879aa
commit c46b06fb81
4 changed files with 20 additions and 3 deletions

View File

@ -1,3 +1,7 @@
2008-03-01 zzz
* Fix netdb.knownLeaseSets count reported by floodfill routers
(was broken by -3)
2008-02-27 zzz
* i2ptunnel: Add 3-hop option to edit.jsp to match configtunnels.jsp
* i2psnark: Remove orion and gaytorrents from default tracker list

View File

@ -17,7 +17,7 @@ import net.i2p.CoreVersion;
public class RouterVersion {
public final static String ID = "$Revision: 1.548 $ $Date: 2008-02-10 15:00:00 $";
public final static String VERSION = "0.6.1.31";
public final static long BUILD = 8;
public final static long BUILD = 9;
public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
System.out.println("Router ID: " + RouterVersion.ID);

View File

@ -71,6 +71,9 @@ class PersistentDataStore extends TransientDataStore {
_writer.queue(key, data);
}
/*
* We don't store leasesets here anymore, use the TransientDataStore count
*
public int countLeaseSets() {
File dbDir = null;
try {
@ -86,6 +89,7 @@ class PersistentDataStore extends TransientDataStore {
else
return leaseSetFiles.length;
}
*/
private void accept(LeaseSet ls) {
super.put(ls.getDestination().calculateHash(), ls);

View File

@ -60,8 +60,17 @@ class TransientDataStore implements DataStore {
}
}
public int countLeaseSets() { return 0; }
public int countLeaseSets() {
int count = 0;
synchronized (_data) {
for (Iterator iter = _data.values().iterator(); iter.hasNext();) {
DataStructure data = (DataStructure)iter.next();
if (data instanceof LeaseSet)
count++;
}
}
return count;
}
/** nothing published more than 5 minutes in the future */
private final static long MAX_FUTURE_PUBLISH_DATE = 5*60*1000;