Author: zothar
Date: 2006-09-10 17:19:42 +0000 (Sun, 10 Sep 2006)
New Revision: 10448

Modified:
   trunk/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java
   trunk/freenet/src/freenet/node/LocationManager.java
Log:
Non-session networkSizeEstimate time period support tweaks.

Modified: trunk/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java       
2006-09-10 16:16:58 UTC (rev 10447)
+++ trunk/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java       
2006-09-10 17:19:42 UTC (rev 10448)
@@ -142,7 +142,7 @@
                        int bwlimitDelayTime = (int) node.getBwlimitDelayTime();
                        int nodeAveragePingTime = (int) 
node.getNodeAveragePingTime();
                        int networkSizeEstimateSession = 
node.getNetworkSizeEstimate(-1);
-                       //int networkSizeEstimateDay = 
node.getNetworkSizeEstimate(now-86400000);
+                       int networkSizeEstimateRecent = 
node.getNetworkSizeEstimate(now - (48*60*60*1000));  // 48 hours
                        DecimalFormat fix4 = new DecimalFormat("0.0000");
                        double missRoutingDistance =  
node.missRoutingDistance.currentValue();
                        DecimalFormat fix1 = new DecimalFormat("##0.0%");
@@ -164,7 +164,9 @@
                                overviewList.addChild("li", 
"bwlimitDelayTime:\u00a0" + bwlimitDelayTime + "ms");
                                overviewList.addChild("li", 
"nodeAveragePingTime:\u00a0" + nodeAveragePingTime + "ms");
                                overviewList.addChild("li", 
"networkSizeEstimateSession:\u00a0" + networkSizeEstimateSession + 
"\u00a0nodes");
-                               //overviewList.addChild("li", 
"networkSizeEstimateDay:\u00a0" + networkSizeEstimateDay + "\u00a0nodes");
+                               if(nodeUptimeSeconds > (48*60*60)) {  // 48 
hours
+                                       overviewList.addChild("li", 
"networkSizeEstimateRecent:\u00a0" + networkSizeEstimateRecent + "\u00a0nodes");
+                               }
                                overviewList.addChild("li", "nodeUptime:\u00a0" 
+ nodeUptimeString);
                                overviewList.addChild("li", 
"missRoutingDistance:\u00a0" + fix4.format(missRoutingDistance));
                                overviewList.addChild("li", 
"backedoffPercent:\u00a0" + fix1.format(backedoffPercent));

Modified: trunk/freenet/src/freenet/node/LocationManager.java
===================================================================
--- trunk/freenet/src/freenet/node/LocationManager.java 2006-09-10 16:16:58 UTC 
(rev 10447)
+++ trunk/freenet/src/freenet/node/LocationManager.java 2006-09-10 17:19:42 UTC 
(rev 10448)
@@ -983,16 +983,17 @@
                }
                else if (timestamp > -1) {
                        Date threshold = new Date(timestamp);
+                       Date locationTime;
                        int numberOfLocationsInPeriod = 0;
-                       Iterator knownLocationsIterator = 
knownLocs.values().iterator();
-                       while (knownLocationsIterator.hasNext()) {
-                               //FIXME: It's not counting :(
-                               if 
(threshold.after((Date)knownLocationsIterator.next())) {
-                                       numberOfLocationsInPeriod++;
-                               }
-                       }
-                       size =  numberOfLocationsInPeriod;
-               }
-               return size;
-    }
+                               Iterator knownLocationsIterator = 
knownLocs.values().iterator();
+                               while (knownLocationsIterator.hasNext()) {
+                                       locationTime = (Date) 
knownLocationsIterator.next();
+                                       if (locationTime.after(threshold)) {
+                                               numberOfLocationsInPeriod++;
+                                       }
+                               }
+                               size = numberOfLocationsInPeriod;
+                       }
+                       return size;
+       }
 }


Reply via email to