Log where uploaded consensus signatures come from

svn:r13241
This commit is contained in:
Peter Palfrader 2008-01-23 08:38:05 +00:00
parent 9d1832dd5a
commit fc91704f78
3 changed files with 6 additions and 4 deletions

View File

@ -1565,7 +1565,7 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
tor_free(body); tor_free(headers); tor_free(reason); tor_free(body); tor_free(headers); tor_free(reason);
return -1; return -1;
} }
if (dirvote_add_signatures(body, &msg)<0) { if (dirvote_add_signatures(body, conn->_base.address, &msg)<0) {
log_warn(LD_DIR, "Problem adding detached signatures from %s:%d: %s", log_warn(LD_DIR, "Problem adding detached signatures from %s:%d: %s",
conn->_base.address, conn->_base.port, msg?msg:"???"); conn->_base.address, conn->_base.port, msg?msg:"???");
} }
@ -2838,7 +2838,7 @@ directory_handle_command_post(dir_connection_t *conn, const char *headers,
if (authdir_mode_v3(options) && if (authdir_mode_v3(options) &&
!strcmp(url,"/tor/post/consensus-signature")) { /* sigs on consensus. */ !strcmp(url,"/tor/post/consensus-signature")) { /* sigs on consensus. */
const char *msg = NULL; const char *msg = NULL;
if (dirvote_add_signatures(body, &msg)>=0) { if (dirvote_add_signatures(body, conn->_base.address, &msg)>=0) {
write_http_status_line(conn, 200, msg?msg:"Signatures stored"); write_http_status_line(conn, 200, msg?msg:"Signatures stored");
} else { } else {
log_warn(LD_DIR, "Unable to store signatures posted by %s: %s", log_warn(LD_DIR, "Unable to store signatures posted by %s: %s",

View File

@ -1823,14 +1823,15 @@ dirvote_add_signatures_to_pending_consensus(
* consensus. Return negative on failure, nonnegative on success. */ * consensus. Return negative on failure, nonnegative on success. */
int int
dirvote_add_signatures(const char *detached_signatures_body, dirvote_add_signatures(const char *detached_signatures_body,
const char *source,
const char **msg) const char **msg)
{ {
if (pending_consensus) { if (pending_consensus) {
log_notice(LD_DIR, "Got a signature. Adding it to the pending consensus."); log_notice(LD_DIR, "Got a signature from %s. Adding it to the pending consensus.", source);
return dirvote_add_signatures_to_pending_consensus( return dirvote_add_signatures_to_pending_consensus(
detached_signatures_body, msg); detached_signatures_body, msg);
} else { } else {
log_notice(LD_DIR, "Got a signature. Queueing it for the next consensus."); log_notice(LD_DIR, "Got a signature from %s. Queueing it for the next consensus.", source);
if (!pending_consensus_signature_list) if (!pending_consensus_signature_list)
pending_consensus_signature_list = smartlist_create(); pending_consensus_signature_list = smartlist_create();
smartlist_add(pending_consensus_signature_list, smartlist_add(pending_consensus_signature_list,

View File

@ -3176,6 +3176,7 @@ struct pending_vote_t * dirvote_add_vote(const char *vote_body,
const char **msg_out, const char **msg_out,
int *status_out); int *status_out);
int dirvote_add_signatures(const char *detached_signatures_body, int dirvote_add_signatures(const char *detached_signatures_body,
const char *source,
const char **msg_out); const char **msg_out);
/* Item access */ /* Item access */