Author: ljn1981
Date: 2006-09-29 09:03:41 +0000 (Fri, 29 Sep 2006)
New Revision: 10560
Modified:
trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
trunk/freenet/src/freenet/node/LocationManager.java
trunk/freenet/src/freenet/node/Node.java
Log:
Don't count the location we are trying to swap with when calculating the
average number of connected peers a node have.
Change variable name for clarification.
Modified: trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
2006-09-29 08:34:55 UTC (rev 10559)
+++ trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
2006-09-29 09:03:41 UTC (rev 10560)
@@ -112,7 +112,7 @@
int networkSizeEstimateSession =
node.getNetworkSizeEstimate(-1);
int networkSizeEstimate24h = 0;
int networkSizeEstimate48h = 0;
- int numberOfLocationsSeenInSwaps =
node.getNumberOfLocationsSeenInSwaps();
+ int numberOfRemotePeerLocationsSeenInSwaps =
node.getNumberOfRemotePeerLocationsSeenInSwaps();
if(nodeUptimeSeconds > (24*60*60)) { // 24 hours
networkSizeEstimate24h =
node.getNetworkSizeEstimate(now - (24*60*60*1000)); // 48 hours
@@ -145,8 +145,8 @@
if(nodeUptimeSeconds > (48*60*60)) { // 48
hours
overviewList.addChild("li",
"networkSizeEstimate48h:\u00a0" + networkSizeEstimate48h + "\u00a0nodes");
}
- if ((numberOfLocationsSeenInSwaps > 0) &&
((swaps > 0) || (noSwaps > 0))) {
- overviewList.addChild("li",
"avrConnPeersPerNode:\u00a0" +
(double)((double)numberOfLocationsSeenInSwaps/(double)(swaps+noSwaps)) +
"\u00a0nodes");
+ if ((numberOfRemotePeerLocationsSeenInSwaps >
0) && ((swaps > 0) || (noSwaps > 0))) {
+ overviewList.addChild("li",
"avrConnPeersPerNode:\u00a0" +
(double)((double)numberOfRemotePeerLocationsSeenInSwaps/(double)(swaps+noSwaps))
+ "\u00a0nodes");
}
overviewList.addChild("li", "nodeUptime:\u00a0"
+ nodeUptimeString);
overviewList.addChild("li",
"missRoutingDistance:\u00a0" + fix4.format(missRoutingDistance));
Modified: trunk/freenet/src/freenet/node/LocationManager.java
===================================================================
--- trunk/freenet/src/freenet/node/LocationManager.java 2006-09-29 08:34:55 UTC
(rev 10559)
+++ trunk/freenet/src/freenet/node/LocationManager.java 2006-09-29 09:03:41 UTC
(rev 10560)
@@ -65,7 +65,7 @@
Location loc;
double locChangeSession = 0.0;
- int numberOfLocationsSeenInSwaps = 0;
+ int numberOfRemotePeerLocationsSeenInSwaps = 0;
/**
* @return The current Location of this node.
@@ -289,8 +289,6 @@
}
registerKnownLocation(hisLoc);
- numberOfLocationsSeenInSwaps++;
-
double[] hisFriendLocs = new double[hisBufLong.length-2];
for(int i=0;i<hisFriendLocs.length;i++) {
hisFriendLocs[i] = Double.longBitsToDouble(hisBufLong[i+2]);
@@ -302,7 +300,7 @@
registerKnownLocation(hisFriendLocs[i]);
}
- numberOfLocationsSeenInSwaps += hisFriendLocs.length;
+ numberOfRemotePeerLocationsSeenInSwaps += hisFriendLocs.length;
// Send our SwapComplete
@@ -471,8 +469,6 @@
}
registerKnownLocation(hisLoc);
- numberOfLocationsSeenInSwaps++;
-
double[] hisFriendLocs = new double[hisBufLong.length-2];
for(int i=0;i<hisFriendLocs.length;i++) {
hisFriendLocs[i] =
Double.longBitsToDouble(hisBufLong[i+2]);
@@ -484,7 +480,7 @@
registerKnownLocation(hisFriendLocs[i]);
}
- numberOfLocationsSeenInSwaps += hisFriendLocs.length;
+ numberOfRemotePeerLocationsSeenInSwaps += hisFriendLocs.length;
if(shouldSwap(myLoc, friendLocs, hisLoc, hisFriendLocs, random
^ hisRandom)) {
timeLastSuccessfullySwapped = System.currentTimeMillis();
Modified: trunk/freenet/src/freenet/node/Node.java
===================================================================
--- trunk/freenet/src/freenet/node/Node.java 2006-09-29 08:34:55 UTC (rev
10559)
+++ trunk/freenet/src/freenet/node/Node.java 2006-09-29 09:03:41 UTC (rev
10560)
@@ -2876,8 +2876,8 @@
return lm.locChangeSession;
}
- public int getNumberOfLocationsSeenInSwaps() {
- return lm.numberOfLocationsSeenInSwaps;
+ public int getNumberOfRemotePeerLocationsSeenInSwaps() {
+ return lm.numberOfRemotePeerLocationsSeenInSwaps;
}
public boolean isAdvancedDarknetEnabled() {