commit 98855e1d5b42fb16ae72b732867104406985eb3e Author: Karsten Loesing karsten.loesing@gmx.net Date: Mon Nov 17 15:03:17 2014 +0100
Remove advertised bandwidth fraction from details.
Implements #13673. --- .../org/torproject/onionoo/docs/DetailsDocument.java | 12 ------------ .../java/org/torproject/onionoo/docs/NodeStatus.java | 9 --------- .../org/torproject/onionoo/server/ResponseBuilder.java | 3 --- .../onionoo/updater/NodeDetailsStatusUpdater.java | 16 ---------------- .../onionoo/writer/DetailsDocumentWriter.java | 2 -- web/protocol.html | 3 ++- 6 files changed, 2 insertions(+), 43 deletions(-)
diff --git a/src/main/java/org/torproject/onionoo/docs/DetailsDocument.java b/src/main/java/org/torproject/onionoo/docs/DetailsDocument.java index 620e908..455097a 100644 --- a/src/main/java/org/torproject/onionoo/docs/DetailsDocument.java +++ b/src/main/java/org/torproject/onionoo/docs/DetailsDocument.java @@ -287,18 +287,6 @@ public class DetailsDocument extends Document { return this.family; }
- private Float advertised_bandwidth_fraction; - public void setAdvertisedBandwidthFraction( - Float advertisedBandwidthFraction) { - if (advertisedBandwidthFraction == null || - advertisedBandwidthFraction >= 0.0) { - this.advertised_bandwidth_fraction = advertisedBandwidthFraction; - } - } - public Float getAdvertisedBandwidthFraction() { - return this.advertised_bandwidth_fraction; - } - private Float consensus_weight_fraction; public void setConsensusWeightFraction(Float consensusWeightFraction) { if (consensusWeightFraction == null || diff --git a/src/main/java/org/torproject/onionoo/docs/NodeStatus.java b/src/main/java/org/torproject/onionoo/docs/NodeStatus.java index 3a93030..ced6cbe 100644 --- a/src/main/java/org/torproject/onionoo/docs/NodeStatus.java +++ b/src/main/java/org/torproject/onionoo/docs/NodeStatus.java @@ -217,15 +217,6 @@ public class NodeStatus extends Document { return this.lastRdnsLookup; }
- private double advertisedBandwidthFraction = -1.0; - public void setAdvertisedBandwidthFraction( - double advertisedBandwidthFraction) { - this.advertisedBandwidthFraction = advertisedBandwidthFraction; - } - public double getAdvertisedBandwidthFraction() { - return this.advertisedBandwidthFraction; - } - private double consensusWeightFraction = -1.0; public void setConsensusWeightFraction(double consensusWeightFraction) { this.consensusWeightFraction = consensusWeightFraction; diff --git a/src/main/java/org/torproject/onionoo/server/ResponseBuilder.java b/src/main/java/org/torproject/onionoo/server/ResponseBuilder.java index d571505..0ffdf10 100644 --- a/src/main/java/org/torproject/onionoo/server/ResponseBuilder.java +++ b/src/main/java/org/torproject/onionoo/server/ResponseBuilder.java @@ -249,9 +249,6 @@ public class ResponseBuilder { dd.setPlatform(detailsDocument.getPlatform()); } else if (field.equals("family")) { dd.setFamily(detailsDocument.getFamily()); - } else if (field.equals("advertised_bandwidth_fraction")) { - dd.setAdvertisedBandwidthFraction( - detailsDocument.getAdvertisedBandwidthFraction()); } else if (field.equals("consensus_weight_fraction")) { dd.setConsensusWeightFraction( detailsDocument.getConsensusWeightFraction()); diff --git a/src/main/java/org/torproject/onionoo/updater/NodeDetailsStatusUpdater.java b/src/main/java/org/torproject/onionoo/updater/NodeDetailsStatusUpdater.java index 9f748db..9963a74 100644 --- a/src/main/java/org/torproject/onionoo/updater/NodeDetailsStatusUpdater.java +++ b/src/main/java/org/torproject/onionoo/updater/NodeDetailsStatusUpdater.java @@ -467,12 +467,10 @@ public class NodeDetailsStatusUpdater implements DescriptorListener, + "going to be 0.0."); } SortedMap<String, Double> - advertisedBandwidths = new TreeMap<String, Double>(), consensusWeights = new TreeMap<String, Double>(), guardWeights = new TreeMap<String, Double>(), middleWeights = new TreeMap<String, Double>(), exitWeights = new TreeMap<String, Double>(); - double totalAdvertisedBandwidth = 0.0; double totalConsensusWeight = 0.0; double totalGuardWeight = 0.0; double totalMiddleWeight = 0.0; @@ -486,16 +484,6 @@ public class NodeDetailsStatusUpdater implements DescriptorListener, boolean isExit = relay.getRelayFlags().contains("Exit") && !relay.getRelayFlags().contains("BadExit"); boolean isGuard = relay.getRelayFlags().contains("Guard"); - DetailsStatus detailsStatus = this.documentStore.retrieve( - DetailsStatus.class, true, fingerprint); - if (detailsStatus != null) { - double advertisedBandwidth = - detailsStatus.getAdvertisedBandwidth(); - if (advertisedBandwidth >= 0.0) { - advertisedBandwidths.put(fingerprint, advertisedBandwidth); - totalAdvertisedBandwidth += advertisedBandwidth; - } - } double consensusWeight = (double) relay.getConsensusWeight(); consensusWeights.put(fingerprint, consensusWeight); totalConsensusWeight += consensusWeight; @@ -531,10 +519,6 @@ public class NodeDetailsStatusUpdater implements DescriptorListener, for (Map.Entry<String, NodeStatus> e : this.relays.entrySet()) { String fingerprint = e.getKey(); NodeStatus relay = e.getValue(); - if (advertisedBandwidths.containsKey(fingerprint)) { - relay.setAdvertisedBandwidthFraction(advertisedBandwidths.get( - fingerprint) / totalAdvertisedBandwidth); - } if (consensusWeights.containsKey(fingerprint)) { relay.setConsensusWeightFraction(consensusWeights.get(fingerprint) / totalConsensusWeight); diff --git a/src/main/java/org/torproject/onionoo/writer/DetailsDocumentWriter.java b/src/main/java/org/torproject/onionoo/writer/DetailsDocumentWriter.java index 3e6b07f..47b7c79 100644 --- a/src/main/java/org/torproject/onionoo/writer/DetailsDocumentWriter.java +++ b/src/main/java/org/torproject/onionoo/writer/DetailsDocumentWriter.java @@ -115,8 +115,6 @@ public class DetailsDocumentWriter implements FingerprintListener, detailsDocument.setAsName(entry.getASName()); detailsDocument.setConsensusWeight(entry.getConsensusWeight()); detailsDocument.setHostName(entry.getHostName()); - detailsDocument.setAdvertisedBandwidthFraction( - (float) entry.getAdvertisedBandwidthFraction()); detailsDocument.setConsensusWeightFraction( (float) entry.getConsensusWeightFraction()); detailsDocument.setGuardProbability( diff --git a/web/protocol.html b/web/protocol.html index 702efbd..f5dc87a 100644 --- a/web/protocol.html +++ b/web/protocol.html @@ -1173,7 +1173,7 @@ found. </li>
<li> -<b>advertised_bandwidth_fraction</b> +<b><font color="red">advertised_bandwidth_fraction</font></b> <code class="typeof">number</code> <span class="required-false">optional</span> <p> @@ -1184,6 +1184,7 @@ rough approximation of the probability of this relay to be selected by clients. Omitted if the relay is not running, or router descriptor containing this information cannot be found. +<font color="red">This field was removed on November 17, 2014.</font> </p> </li>