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

[or-cvs] r16432: Document that we break ties in favor of smaller SD digest if (in tor/trunk: doc/spec src/or)



Author: weasel
Date: 2008-08-05 14:54:23 -0400 (Tue, 05 Aug 2008)
New Revision: 16432

Modified:
   tor/trunk/doc/spec/dir-spec.txt
   tor/trunk/src/or/dirvote.c
Log:
Document that we break ties in favor of smaller SD digest if there are still ties after comparing the published timestamp

Modified: tor/trunk/doc/spec/dir-spec.txt
===================================================================
--- tor/trunk/doc/spec/dir-spec.txt	2008-08-05 18:53:18 UTC (rev 16431)
+++ tor/trunk/doc/spec/dir-spec.txt	2008-08-05 18:54:23 UTC (rev 16432)
@@ -1145,8 +1145,9 @@
         * Two router entries are "the same" if they have the same
           <descriptor digest, published time, nickname, IP, ports> tuple.
           We choose the tuple for a given router as whichever tuple appears
-          for that router in the most votes.  We break ties in favor of
-          the more recently published.
+          for that router in the most votes.  We break ties first in favor of
+          the more recently published, then in favor of smaller server
+          descriptor digest.
 
         * The Named flag appears if it is included for this routerstatus by
           _any_ authority, and if all authorities that list it list the same

Modified: tor/trunk/src/or/dirvote.c
===================================================================
--- tor/trunk/src/or/dirvote.c	2008-08-05 18:53:18 UTC (rev 16431)
+++ tor/trunk/src/or/dirvote.c	2008-08-05 18:54:23 UTC (rev 16432)
@@ -337,7 +337,8 @@
 
 /** Given a list of vote_routerstatus_t, all for the same router identity,
  * return whichever is most frequent, breaking ties in favor of more
- * recently published vote_routerstatus_t.
+ * recently published vote_routerstatus_t and in case of ties there,
+ * in favour of smaller descriptor digest.
  */
 static vote_routerstatus_t *
 compute_routerstatus_consensus(smartlist_t *votes)
@@ -346,6 +347,10 @@
   int most_n = 0, cur_n = 0;
   time_t most_published = 0;
 
+  /* _compare_vote_rs() sorts the items by identity digest (all the same),
+   * then by SD digest.  That way, if we have a tie that the published_on
+   * date cannot tie, we use the descriptor with the smaller digest.
+   */
   smartlist_sort(votes, _compare_vote_rs);
   SMARTLIST_FOREACH(votes, vote_routerstatus_t *, rs,
   {