Author: toad
Date: 2007-12-21 23:43:23 +0000 (Fri, 21 Dec 2007)
New Revision: 16771
Modified:
trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
Log:
Missed a file - fix stats page, part 2
Modified: trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
2007-12-21 23:38:52 UTC (rev 16770)
+++ trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
2007-12-21 23:43:23 UTC (rev 16771)
@@ -1004,9 +1004,13 @@
double peerDistance;
int histogramIndex;
int peerCount = peerNodeStatuses.length;
+ int newPeerCount = 0;
for (int peerIndex = 0; peerIndex < peerCount; peerIndex++) {
peerNodeStatus = peerNodeStatuses[peerIndex];
peerLocation = peerNodeStatus.getLocation();
+ if(!peerNodeStatus.isSearchable()) continue;
+ if(peerLocation < 0.0 || peerLocation > 1.0) continue;
+ newPeerCount++;
peerDistance = Location.distance( myLocation,
peerLocation );
histogramIndex = (int) (Math.floor(peerDistance *
HISTOGRAM_LENGTH * 2));
if (peerNodeStatus.isConnected()) {
@@ -1024,10 +1028,10 @@
peerHistogramGraphCell =
peerHistogramGraphTableRow.addChild("td", "style", "height: 100px;");
peerHistogramLegendCell.addChild("div", "class",
"histogramLabel").addChild("#", fix1p2.format(((double) i) / ( HISTOGRAM_LENGTH
* 2 )));
//
- histogramPercent = ((double) histogramConnected[ i ] )
/ peerCount;
+ histogramPercent = ((double) histogramConnected[ i ] )
/ newPeerCount;
peerHistogramGraphCell.addChild("div", new String[] {
"class", "style" }, new String[] { "histogramConnected", "height: " +
fix3pctUS.format(histogramPercent) + "; width: 100%;" }, "\u00a0");
//
- histogramPercent = ((double) histogramDisconnected[ i ]
) / peerCount;
+ histogramPercent = ((double) histogramDisconnected[ i ]
) / newPeerCount;
peerHistogramGraphCell.addChild("div", new String[] {
"class", "style" }, new String[] { "histogramDisconnected", "height: " +
fix3pctUS.format(histogramPercent) + "; width: 100%;" }, "\u00a0");
}
}