[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] More documentation for proposal 227 work



commit ddfdeb5659be17b3e7a4c34b749207bdeae5124a
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Sat Jan 10 15:44:32 2015 -0500

    More documentation for proposal 227 work
---
 doc/tor.1.txt          |    6 ++++++
 src/common/container.c |    5 ++++-
 src/or/dirvote.c       |   13 ++++++++++---
 3 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/doc/tor.1.txt b/doc/tor.1.txt
index 9e86a67..9b491f7 100644
--- a/doc/tor.1.txt
+++ b/doc/tor.1.txt
@@ -1881,6 +1881,12 @@ on the public Tor network.
     multiple times: the values from multiple lines are spliced together. When
     this is set then **VersioningAuthoritativeDirectory** should be set too.
 
+[[RecommendedPackageVersions]] **RecommendedPackageVersions** __PACKAGENAME__ __VERSION__ __URL__ __DIGESTTYPE__**=**__DIGEST__ ::
+    Adds "package" line to the directory authority's vote.  This information
+    is used to vote on the correct URL and digest for the released versions
+    of different Tor-related packages, so that the consensus can certify
+    them.  This line may appear any number of times.
+
 [[RecommendedClientVersions]] **RecommendedClientVersions** __STRING__::
     STRING is a comma-separated list of Tor versions currently believed to be
     safe for clients to use. This information is included in version 2
diff --git a/src/common/container.c b/src/common/container.c
index 68e3711..864fd8a 100644
--- a/src/common/container.c
+++ b/src/common/container.c
@@ -735,7 +735,10 @@ smartlist_get_most_frequent_string(smartlist_t *sl)
   return smartlist_get_most_frequent(sl, compare_string_ptrs_);
 }
 
-/** Return the most frequent string in the sorted list <b>sl</b> */
+/** Return the most frequent string in the sorted list <b>sl</b>.
+ * If <b>count_out</b> is provided, set <b>count_out</b> to the
+ * number of times that string appears.
+ */
 char *
 smartlist_get_most_frequent_string_(smartlist_t *sl, int *count_out)
 {
diff --git a/src/or/dirvote.c b/src/or/dirvote.c
index c09c4fa..7739c52 100644
--- a/src/or/dirvote.c
+++ b/src/or/dirvote.c
@@ -1886,13 +1886,18 @@ networkstatus_compute_consensus(smartlist_t *votes,
   return result;
 }
 
-/** DOCDOC */
+/** Given a list of networkstatus_t for each vote, return a newly allocated
+ * string containing the "package" lines for the vote. */
 STATIC char *
 compute_consensus_package_lines(smartlist_t *votes)
 {
   const int n_votes = smartlist_len(votes);
+
+  /* This will be a map from "packagename version" strings to arrays
+   * of const char *, with the i'th member of the array corresponding to the
+   * package line from the i'th vote.
+   */
   strmap_t *package_status = strmap_new();
-  smartlist_t *result_list = smartlist_new();
 
   SMARTLIST_FOREACH_BEGIN(votes, networkstatus_t *, v) {
     if (! v->package_lines)
@@ -1901,6 +1906,7 @@ compute_consensus_package_lines(smartlist_t *votes)
       if (! validate_recommended_package_line(line))
         continue;
 
+      /* Skip 'cp' to the second space in the line. */
       const char *cp = strchr(line, ' ');
       if (!cp) continue;
       ++cp;
@@ -1919,7 +1925,8 @@ compute_consensus_package_lines(smartlist_t *votes)
     } SMARTLIST_FOREACH_END(line);
   } SMARTLIST_FOREACH_END(v);
 
-  smartlist_t *entries = smartlist_new();
+  smartlist_t *entries = smartlist_new(); /* temporary */
+  smartlist_t *result_list = smartlist_new(); /* output */
   STRMAP_FOREACH(package_status, key, const char **, values) {
     int i, count=-1;
     for (i = 0; i < n_votes; ++i) {



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits