[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r10634: Adjust networkstatus_compute_consensus to take an argument s (in tor/trunk: . src/or)
Author: nickm
Date: 2007-06-17 11:10:23 -0400 (Sun, 17 Jun 2007)
New Revision: 10634
Modified:
tor/trunk/
tor/trunk/src/or/dirvote.c
tor/trunk/src/or/or.h
tor/trunk/src/or/test.c
Log:
r13418@catbus: nickm | 2007-06-14 13:29:21 -0400
Adjust networkstatus_compute_consensus to take an argument saying how many voters there _should_ be.
Property changes on: tor/trunk
___________________________________________________________________
svk:merge ticket from /tor/trunk [r13418] on 8246c3cf-6607-4228-993b-4d95d33730f1
Modified: tor/trunk/src/or/dirvote.c
===================================================================
--- tor/trunk/src/or/dirvote.c 2007-06-17 12:40:29 UTC (rev 10633)
+++ tor/trunk/src/or/dirvote.c 2007-06-17 15:10:23 UTC (rev 10634)
@@ -197,6 +197,8 @@
return r;
if ((r = strcmp(b->status.nickname, a->status.nickname)))
return r;
+ if ((r = (((int)b->status.addr) - ((int)a->status.addr))))
+ return r;
if ((r = (((int)b->status.or_port) - ((int)a->status.or_port))))
return r;
if ((r = (((int)b->status.dir_port) - ((int)a->status.dir_port))))
@@ -263,6 +265,7 @@
/** DOCDOC */
char *
networkstatus_compute_consensus(smartlist_t *votes,
+ int total_authorities,
crypto_pk_env_t *identity_key,
crypto_pk_env_t *signing_key)
{
@@ -273,7 +276,7 @@
int vote_seconds, dist_seconds;
char *client_versions = NULL, *server_versions = NULL;
smartlist_t *flags;
- int total_authorities = smartlist_len(votes); /*XXXX020 not right. */
+ tor_assert(total_authorities >= smartlist_len(votes));
if (!smartlist_len(votes)) {
log_warn(LD_DIR, "Can't compute a consensus from no votes.");
@@ -516,7 +519,7 @@
}
if (rs->flags & (U64_LITERAL(1) << named_flag[v_sl_idx])) {
if (chosen_name && strcmp(chosen_name, rs->status.nickname))
- naming_conflict = 1;
+ naming_conflict = 1; /* XXXX020 warn? */
chosen_name = rs->status.nickname;
}
Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h 2007-06-17 12:40:29 UTC (rev 10633)
+++ tor/trunk/src/or/or.h 2007-06-17 15:10:23 UTC (rev 10634)
@@ -2758,6 +2758,7 @@
void networkstatus_vote_free(networkstatus_vote_t *ns);
char *networkstatus_compute_consensus(smartlist_t *votes,
+ int total_authorities,
crypto_pk_env_t *identity_key,
crypto_pk_env_t *signing_key);
networkstatus_voter_info_t *networkstatus_get_voter_by_id(
Modified: tor/trunk/src/or/test.c
===================================================================
--- tor/trunk/src/or/test.c 2007-06-17 12:40:29 UTC (rev 10633)
+++ tor/trunk/src/or/test.c 2007-06-17 15:10:23 UTC (rev 10634)
@@ -2386,7 +2386,7 @@
smartlist_add(votes, v3);
smartlist_add(votes, v1);
smartlist_add(votes, v2);
- consensus_text = networkstatus_compute_consensus(votes,
+ consensus_text = networkstatus_compute_consensus(votes, 3,
cert3->identity_key,
sign_skey_3);
test_assert(consensus_text);