r13998@kushana: nickm | 2007-08-13 19:20:28 -0400

Add some insanely verbose log messages on voting authorities.


svn:r11097
This commit is contained in:
Nick Mathewson 2007-08-13 23:23:06 +00:00
parent a1ce60f9a6
commit b6c548094c
2 changed files with 18 additions and 3 deletions

View File

@ -1084,12 +1084,14 @@ dirvote_act(time_t now)
if (!voting_schedule.voting_starts) if (!voting_schedule.voting_starts)
dirvote_recalculate_timing(now); dirvote_recalculate_timing(now);
if (voting_schedule.voting_starts < now && !voting_schedule.have_voted) { if (voting_schedule.voting_starts < now && !voting_schedule.have_voted) {
log_notice(LD_DIR, "Time to vote.");
dirvote_perform_vote(); dirvote_perform_vote();
voting_schedule.have_voted = 1; voting_schedule.have_voted = 1;
} }
/* XXXX020 after a couple minutes here, start trying to fetch votes. */ /* XXXX020 after a couple minutes here, start trying to fetch votes. */
if (voting_schedule.voting_ends < now && if (voting_schedule.voting_ends < now &&
!voting_schedule.have_built_consensus) { !voting_schedule.have_built_consensus) {
log_notice(LD_DIR, "Time to compute a consensus.");
dirvote_compute_consensus(); dirvote_compute_consensus();
/* XXXX020 we will want to try again later if we haven't got enough /* XXXX020 we will want to try again later if we haven't got enough
* votes yet. */ * votes yet. */
@ -1097,12 +1099,14 @@ dirvote_act(time_t now)
} }
if (voting_schedule.interval_starts < now && if (voting_schedule.interval_starts < now &&
!voting_schedule.have_published_consensus) { !voting_schedule.have_published_consensus) {
log_notice(LD_DIR, "Time to publish the consensus.");
dirvote_publish_consensus(); dirvote_publish_consensus();
/* XXXX020 we will want to try again later if we haven't got enough /* XXXX020 we will want to try again later if we haven't got enough
* signatures yet. */ * signatures yet. */
voting_schedule.have_published_consensus = 1; voting_schedule.have_published_consensus = 1;
} }
if (voting_schedule.discard_old_votes < now) { if (voting_schedule.discard_old_votes < now) {
log_notice(LD_DIR, "Time to discard old votes consensus.");
dirvote_clear_pending_votes(); dirvote_clear_pending_votes();
dirvote_recalculate_timing(now); dirvote_recalculate_timing(now);
} }
@ -1148,6 +1152,7 @@ dirvote_perform_vote(void)
V3_AUTHORITY, V3_AUTHORITY,
pending_vote->vote_body->dir, pending_vote->vote_body->dir,
pending_vote->vote_body->dir_len, 0); pending_vote->vote_body->dir_len, 0);
log_notice(LD_DIR, "Vote posted.");
} }
/** DOCDOC */ /** DOCDOC */
@ -1168,6 +1173,7 @@ dirvote_clear_pending_votes(void)
tor_free(cp)); tor_free(cp));
smartlist_clear(pending_consensus_signature_list); smartlist_clear(pending_consensus_signature_list);
} }
log_notice(LD_DIR, "Pending votes cleared.");
} }
/** DOCDOC */ /** DOCDOC */
@ -1327,6 +1333,7 @@ dirvote_compute_consensus(void)
smartlist_clear(pending_consensus_signature_list); smartlist_clear(pending_consensus_signature_list);
} }
log_notice(LD_DIR, "Consensus computed.");
return 0; return 0;
err: err:
if (votes) if (votes)
@ -1418,10 +1425,15 @@ dirvote_publish_consensus(void)
{ {
/* Can we actually publish it yet? */ /* Can we actually publish it yet? */
if (!pending_consensus || if (!pending_consensus ||
networkstatus_check_consensus_signature(pending_consensus)<0) networkstatus_check_consensus_signature(pending_consensus)<0) {
log_warn(LD_DIR, "Not enough info to publish pending consensus");
return -1; return -1;
}
networkstatus_set_current_consensus(pending_consensus_body, 0); if (networkstatus_set_current_consensus(pending_consensus_body, 0))
log_warn(LD_DIR, "Error publishing consensus");
else
log_warn(LD_DIR, "Consensus published.");
return 0; return 0;
} }

View File

@ -3868,11 +3868,14 @@ networkstatus_set_current_consensus(const char *consensus, int from_cache)
networkstatus_vote_t *c; networkstatus_vote_t *c;
/* Make sure it's parseable. */ /* Make sure it's parseable. */
c = networkstatus_parse_vote_from_string(consensus, 0); c = networkstatus_parse_vote_from_string(consensus, 0);
if (!c) if (!c) {
log_warn(LD_DIR, "Unable to parse networkstatus consensus");
return -1; return -1;
}
/* Make sure it's signed enough. */ /* Make sure it's signed enough. */
if (networkstatus_check_consensus_signature(c)<0) { if (networkstatus_check_consensus_signature(c)<0) {
log_warn(LD_DIR, "Not enough good signatures on networkstatus consensus");
networkstatus_vote_free(c); networkstatus_vote_free(c);
return -1; return -1;
} }