[or-cvs] r11837: Merge networkstatus_add_signatures_impl into the only functi (in tor/trunk: . src/or)

nickm at seul.org nickm at seul.org
Wed Oct 10 19:33:02 UTC 2007


Author: nickm
Date: 2007-10-10 15:33:01 -0400 (Wed, 10 Oct 2007)
New Revision: 11837

Modified:
   tor/trunk/
   tor/trunk/src/or/dirvote.c
Log:
 r15632 at catbus:  nickm | 2007-10-10 13:48:44 -0400
 Merge networkstatus_add_signatures_impl into the only function that calls it.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r15632] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/trunk/src/or/dirvote.c
===================================================================
--- tor/trunk/src/or/dirvote.c	2007-10-10 17:56:53 UTC (rev 11836)
+++ tor/trunk/src/or/dirvote.c	2007-10-10 19:33:01 UTC (rev 11837)
@@ -806,25 +806,31 @@
     return -2;
 }
 
-/** Given a consensus vote <b>target</b> and a list of
- * notworkstatus_voter_info_t in <b>src_voter_list</b> that correspond to the
- * same consensus, check whether there are any new signatures in
- * <b>src_voter_list</b> that should be added to <b>target.  (A signature
- * should be added if we have no signature for that voter in <b>target</b>
- * yet, or if we have no verifiable signature and the new signature is
- * verifiable.)   Return the number of signatures added or changed, or
- * -1 on error. */
-static int
-networkstatus_add_signatures_impl(networkstatus_vote_t *target,
-                                  smartlist_t *src_voter_list)
+/** Given a consensus vote <b>target</b> and a set of detached signatures in
+ * <b>sigs</b> that correspond to the same consensus, check whether there are
+ * any new signatures in <b>src_voter_list</b> that should be added to
+ * <b>target.  (A signature should be added if we have no signature for that
+ * voter in <b>target</b> yet, or if we have no verifiable signature and the
+ * new signature is verifiable.)  Return the number of signatures added or
+ * changed, or -1 if the document signed by <b>sigs</b> isn't the same
+ * document as <b>target</b>. */
+int
+networkstatus_add_detached_signatures(networkstatus_vote_t *target,
+                                      ns_detached_signatures_t *sigs)
 {
-  /*XXXX020 merge with the only function that calls it. */
   int r = 0;
+  tor_assert(sigs);
   tor_assert(target);
   tor_assert(!target->is_vote);
 
+
+  /* Are they the same consensus? */
+  if (memcmp(target->networkstatus_digest, sigs->networkstatus_digest,
+             DIGEST_LEN))
+    return -1;
+
   /* For each voter in src... */
-  SMARTLIST_FOREACH(src_voter_list, networkstatus_voter_info_t *, src_voter,
+  SMARTLIST_FOREACH(sigs->signatures, networkstatus_voter_info_t *, src_voter,
     {
       networkstatus_voter_info_t *target_voter =
         networkstatus_get_voter_by_id(target, src_voter->identity_digest);
@@ -864,22 +870,7 @@
   return r;
 }
 
-/** As networkstatus_add_signature_impl, but takes new signatures
- * from the detached signatures document <b>sigs</b>. */
-int
-networkstatus_add_detached_signatures(networkstatus_vote_t *target,
-                                      ns_detached_signatures_t *sigs)
-{
-  tor_assert(sigs);
 
-  /* Are they the same consensus? */
-  if (memcmp(target->networkstatus_digest, sigs->networkstatus_digest,
-             DIGEST_LEN))
-    return -1;
-
-  return networkstatus_add_signatures_impl(target, sigs->signatures);
-}
-
 /** Return a newly allocated string holding the detached-signatures document
  * corresponding to the signatures on <b>consensus</b>. */
 char *



More information about the tor-commits mailing list