commit 2cb2bd456cf938b67f38f96141d3b9a629f098f5 Author: Karsten Loesing karsten.loesing@gmx.net Date: Sun Apr 20 13:59:16 2014 +0200
Always contain non-empty documents for known relays/bridges.
If we can't find a bandwidth/weights/clients/uptime document for a known relay or bridge, generate one on the fly that only contains the relay's or bridge's (hashed) fingerprint.
Implements #11428. --- src/org/torproject/onionoo/ResponseBuilder.java | 16 ++++------------ web/index.html | 15 ++++++++++----- 2 files changed, 14 insertions(+), 17 deletions(-)
diff --git a/src/org/torproject/onionoo/ResponseBuilder.java b/src/org/torproject/onionoo/ResponseBuilder.java index 2b22c59..f76d078 100644 --- a/src/org/torproject/onionoo/ResponseBuilder.java +++ b/src/org/torproject/onionoo/ResponseBuilder.java @@ -209,9 +209,7 @@ public class ResponseBuilder { bandwidthLines.length() - 1); return bandwidthLines; } else { - // TODO We should probably log that we didn't find a bandwidth - // document that we expected to exist. - return ""; + return "{"fingerprint":"" + fingerprint.toUpperCase() + ""}"; } }
@@ -225,9 +223,7 @@ public class ResponseBuilder { weightsLines = weightsLines.substring(0, weightsLines.length() - 1); return weightsLines; } else { - // TODO We should probably log that we didn't find a weights - // document that we expected to exist. - return ""; + return "{"fingerprint":"" + fingerprint.toUpperCase() + ""}"; } }
@@ -241,9 +237,7 @@ public class ResponseBuilder { clientsLines = clientsLines.substring(0, clientsLines.length() - 1); return clientsLines; } else { - // TODO We should probably log that we didn't find a clients - // document that we expected to exist. - return ""; + return "{"fingerprint":"" + fingerprint.toUpperCase() + ""}"; } }
@@ -257,9 +251,7 @@ public class ResponseBuilder { uptimeLines = uptimeLines.substring(0, uptimeLines.length() - 1); return uptimeLines; } else { - // TODO We should probably log that we didn't find an uptime - // document that we expected to exist. - return ""; + return "{"fingerprint":"" + fingerprint.toUpperCase() + ""}"; } } } diff --git a/web/index.html b/web/index.html index afe4f88..c941f4e 100644 --- a/web/index.html +++ b/web/index.html @@ -1474,7 +1474,7 @@ hexadecimal characters. <li> <b>write_history</b> <code class="typeof">object</code> -<span class="required-true">required</span> +<span class="required-false">optional</span> <p> Object containing graph history objects with written bytes for different time periods. @@ -1493,18 +1493,20 @@ The unit is bytes per second. Contained graph history objects may contain null values if the relay did not provide any bandwidth data or only data for less than 20% of a given time period. +<font color="red">As of April 20, 2014, this field is optional.</font> </p> </li>
<li> <b>read_history</b> <code class="typeof">object</code> -<span class="required-true">required</span> +<span class="required-false">optional</span> <p> Object containing graph history objects with read bytes for different time periods. The specification of graph history objects is similar to those in the <strong>write_history</strong> field. +<font color="red">As of April 20, 2014, this field is optional.</font> </p> </li>
@@ -1531,24 +1533,26 @@ of 40 upper-case hexadecimal characters. <li> <b>write_history</b> <code class="typeof">object</code> -<span class="required-true">required</span> +<span class="required-false">optional</span> <p> Object containing graph history objects with written bytes for different time periods. The specification of graph history objects is similar to those in the <strong>write_history</strong> field of <strong>relays</strong>. +<font color="red">As of April 20, 2014, this field is optional.</font> </p> </li>
<li> <b>read_history</b> <code class="typeof">object</code> -<span class="required-true">required</span> +<span class="required-false">optional</span> <p> Object containing graph history objects with read bytes for different time periods. The specification of graph history objects is similar to those in the <strong>write_history</strong> field of <strong>relays</strong>. +<font color="red">As of April 20, 2014, this field is optional.</font> </p> </li>
@@ -2023,11 +2027,12 @@ of 40 upper-case hexadecimal characters. <li> <b>uptime</b> <code class="typeof">object</code> -<span class="required-true">required</span> +<span class="required-false">optional</span> <p> Object containing uptime history objects for different time periods. The specification of uptime history objects is similar to those in the <strong>uptime</strong> field of <strong>relays</strong>. +<font color="red">As of April 20, 2014, this field is optional.</font> </p> </li>
tor-commits@lists.torproject.org