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

[or-cvs] r14450: Spec compliance: sort id fingerprints in consensus get reque (tor/trunk/src/or)



Author: weasel
Date: 2008-04-24 11:39:10 -0400 (Thu, 24 Apr 2008)
New Revision: 14450

Modified:
   tor/trunk/src/or/directory.c
Log:
Spec compliance: sort id fingerprints in consensus get requests


Modified: tor/trunk/src/or/directory.c
===================================================================
--- tor/trunk/src/or/directory.c	2008-04-24 15:39:08 UTC (rev 14449)
+++ tor/trunk/src/or/directory.c	2008-04-24 15:39:10 UTC (rev 14450)
@@ -773,6 +773,17 @@
   return TO_CONN(conn)->linked;
 }
 
+/** Helper for sorting
+ *
+ * sort strings alphabetically
+ */
+static int
+_compare_strs(const void **a, const void **b)
+{
+  const char *s1 = *a, *s2 = *b;
+  return strcmp(s1, s2);
+}
+
 /** Return the URL we should use for a consensus download.
  *
  * This url depends on whether or not the server we go to
@@ -801,6 +812,7 @@
                       ds->digest, CONDITIONAL_CONSENSUS_FPR_LEN);
         smartlist_add(authority_digets, hex);
       });
+    smartlist_sort(authority_digets, _compare_strs);
     authority_id_list = smartlist_join_strings(authority_digets,
                                                "+", 0, NULL);