aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2012-01-08 12:14:44 -0500
committerRoger Dingledine <arma@torproject.org>2012-01-08 12:14:44 -0500
commitcc1580dbe02f0f285fca65b7b388d99dbaf78f5c (patch)
treef96cb940cc08619b437759aa39fb30213e837b38 /src
parent04bf17c50c111e80d715e984b5b3a4ad8feb5e81 (diff)
downloadtor-cc1580dbe02f0f285fca65b7b388d99dbaf78f5c.tar
tor-cc1580dbe02f0f285fca65b7b388d99dbaf78f5c.tar.gz
when the consensus fails, list which dir auths were in or out
Diffstat (limited to 'src')
-rw-r--r--src/or/networkstatus.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index b0ef74b02..d5637b2c9 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -471,6 +471,8 @@ networkstatus_check_consensus_signature(networkstatus_t *consensus,
int n_no_signature = 0;
int n_v3_authorities = get_n_authorities(V3_AUTHORITY);
int n_required = n_v3_authorities/2 + 1;
+ smartlist_t *list_good = smartlist_create();
+ smartlist_t *list_no_signature = smartlist_create();
smartlist_t *need_certs_from = smartlist_create();
smartlist_t *unrecognized = smartlist_create();
smartlist_t *missing_authorities = smartlist_create();
@@ -521,11 +523,13 @@ networkstatus_check_consensus_signature(networkstatus_t *consensus,
else if (sig->bad_signature)
++bad_here;
} SMARTLIST_FOREACH_END(sig);
- if (good_here)
+
+ if (good_here) {
++n_good;
- else if (bad_here)
+ smartlist_add(list_good, voter->nickname);
+ } else if (bad_here) {
++n_bad;
- else if (missing_key_here) {
+ } else if (missing_key_here) {
++n_missing_key;
if (dl_failed_key_here)
++n_dl_failed_key;
@@ -533,6 +537,7 @@ networkstatus_check_consensus_signature(networkstatus_t *consensus,
++n_unknown;
} else {
++n_no_signature;
+ smartlist_add(list_no_signature, voter->nickname);
}
} SMARTLIST_FOREACH_END(voter);
@@ -580,13 +585,17 @@ networkstatus_check_consensus_signature(networkstatus_t *consensus,
{
smartlist_t *sl = smartlist_create();
char *cp;
+ char *tmp = smartlist_join_strings(list_good, " ", 0, NULL);
tor_asprintf(&cp, "A consensus needs %d good signatures from recognized "
- "authorities for us to accept it. This one has %d.",
- n_required, n_good);
+ "authorities for us to accept it. This one has %d (%s).",
+ n_required, n_good, tmp);
+ tor_free(tmp);
smartlist_add(sl,cp);
if (n_no_signature) {
- tor_asprintf(&cp, "%d of the authorities we know didn't sign it.",
- n_no_signature);
+ tmp = smartlist_join_strings(list_no_signature, " ", 0, NULL);
+ tor_asprintf(&cp, "%d (%s) of the authorities we know didn't sign it.",
+ n_no_signature, tmp);
+ tor_free(tmp);
smartlist_add(sl,cp);
}
if (n_unknown) {
@@ -612,6 +621,8 @@ networkstatus_check_consensus_signature(networkstatus_t *consensus,
}
}
+ smartlist_free(list_good);
+ smartlist_free(list_no_signature);
smartlist_free(unrecognized);
smartlist_free(need_certs_from);
smartlist_free(missing_authorities);