mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-27 22:03:31 +01:00
r16033@catbus: nickm | 2007-10-22 12:26:13 -0400
Download some XXXX020s in dirvote.c and mark some functions that may not belong there. svn:r12103
This commit is contained in:
parent
c47eb2c8d9
commit
7b80011990
@ -509,8 +509,12 @@ connection_dir_request_failed(dir_connection_t *conn)
|
||||
log_info(LD_DIR, "Giving up on directory server at '%s'; retrying",
|
||||
conn->_base.address);
|
||||
connection_dir_download_cert_failed(conn, 0);
|
||||
} else {
|
||||
/* XXXX020 handle failing: votes. signatures. */
|
||||
} else if (conn->_base.purpose == DIR_PURPOSE_FETCH_DETACHED_SIGNATURES) {
|
||||
log_info(LD_DIR, "Giving up downloading detached signatures from '%s'",
|
||||
conn->_base.address);
|
||||
} else if (conn->_base.purpose == DIR_PURPOSE_FETCH_STATUS_VOTE) {
|
||||
log_info(LD_DIR, "Giving up downloading votes from '%s'",
|
||||
conn->_base.address);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2094,6 +2098,7 @@ directory_handle_command_get(dir_connection_t *conn, const char *headers,
|
||||
int is_v3 = !strcmpstart(url, "/tor/status-vote");
|
||||
const char *request_type = NULL;
|
||||
const char *key = url + strlen("/tor/status/");
|
||||
int lifetime = NETWORKSTATUS_CACHE_LIFETIME;
|
||||
if (!is_v3) {
|
||||
dirserv_get_networkstatus_v2_fingerprints(dir_fps, key);
|
||||
if (!strcmpstart(key, "fp/"))
|
||||
@ -2106,9 +2111,11 @@ directory_handle_command_get(dir_connection_t *conn, const char *headers,
|
||||
else
|
||||
request_type = "/tor/status/?";
|
||||
} else {
|
||||
networkstatus_vote_t *v = networkstatus_get_current_consensus();
|
||||
smartlist_add(dir_fps, tor_memdup("\0\0\0\0\0\0\0\0\0\0"
|
||||
"\0\0\0\0\0\0\0\0\0\0", 20));
|
||||
request_type = deflated?"v3.z":"v3";
|
||||
lifetime = (v && v->fresh_until > now) ? v->fresh_until - now : 0;
|
||||
}
|
||||
|
||||
if (!smartlist_len(dir_fps)) { /* we failed to create/cache cp */
|
||||
@ -2143,7 +2150,7 @@ directory_handle_command_get(dir_connection_t *conn, const char *headers,
|
||||
// note_request(request_type,dlen);
|
||||
(void) request_type;
|
||||
write_http_response_header(conn, -1, deflated,
|
||||
smartlist_len(dir_fps) == 1 ? NETWORKSTATUS_CACHE_LIFETIME:0);
|
||||
smartlist_len(dir_fps) == 1 ? lifetime : 0);
|
||||
conn->fingerprint_stack = dir_fps;
|
||||
if (! deflated)
|
||||
conn->zlib_state = tor_zlib_new(0, ZLIB_METHOD);
|
||||
|
@ -28,6 +28,7 @@ static int dirvote_publish_consensus(void);
|
||||
* Voting and consensus generation
|
||||
* ===== */
|
||||
|
||||
/*XXXX020 move to networkstaus.c */
|
||||
/** Clear all storage held in <b>ns</b>. */
|
||||
void
|
||||
networkstatus_vote_free(networkstatus_vote_t *ns)
|
||||
@ -74,6 +75,7 @@ networkstatus_vote_free(networkstatus_vote_t *ns)
|
||||
tor_free(ns);
|
||||
}
|
||||
|
||||
/*XXXX020 move to networkstaus.c */
|
||||
/** Return the voter info from <b>vote</b> for the voter whose identity digest
|
||||
* is <b>identity</b>, or NULL if no such voter is associated with
|
||||
* <b>vote</b>. */
|
||||
@ -816,6 +818,7 @@ networkstatus_compute_consensus(smartlist_t *votes,
|
||||
return result;
|
||||
}
|
||||
|
||||
/*XXXX020 move to networkstatus.c ? */
|
||||
/** Check whether the signature on <b>voter</b> is correctly signed by
|
||||
* the signing key of <b>cert</b>. Return -1 if <b>cert</b> doesn't match the
|
||||
* signing key; otherwise set the good_signature or bad_signature flag on
|
||||
@ -848,6 +851,7 @@ networkstatus_check_voter_signature(networkstatus_vote_t *consensus,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*XXXX020 move to networkstatus.c ? */
|
||||
/** Given a v3 networkstatus consensus in <b>consensus</b>, check every
|
||||
* as-yet-unchecked signature on <b>consensus</b>. Return 1 if there is a
|
||||
* signature from every recognized authority on it, 0 if there are
|
||||
@ -1123,6 +1127,7 @@ ns_detached_signatures_free(ns_detached_signatures_t *s)
|
||||
* Certificate functions
|
||||
* ===== */
|
||||
|
||||
/*XXXX020 move to routerlist.c ? */
|
||||
/** Free storage held in <b>cert</b>. */
|
||||
void
|
||||
authority_cert_free(authority_cert_t *cert)
|
||||
@ -1321,8 +1326,8 @@ dirvote_act(or_options_t *options, time_t now)
|
||||
!voting_schedule.have_built_consensus) {
|
||||
log_notice(LD_DIR, "Time to compute a consensus.");
|
||||
dirvote_compute_consensus();
|
||||
/* XXXX020 we will want to try again later if we haven't got enough
|
||||
* votes yet. */
|
||||
/* XXXX We will want to try again later if we haven't got enough
|
||||
* votes yet. Implement this if it turns out to ever happen. */
|
||||
voting_schedule.have_built_consensus = 1;
|
||||
}
|
||||
if (voting_schedule.fetch_missing_signatures < now &&
|
||||
@ -1337,8 +1342,8 @@ dirvote_act(or_options_t *options, time_t now)
|
||||
dirvote_publish_consensus();
|
||||
dirvote_clear_votes(0);
|
||||
voting_schedule.have_published_consensus = 1;
|
||||
/* XXXX020 we will want to try again later if we haven't got enough
|
||||
* signatures yet. */
|
||||
/* XXXX We will want to try again later if we haven't got enough
|
||||
* signatures yet. Implement this if it turns out to ever happen. */
|
||||
dirvote_recalculate_timing(options, now);
|
||||
}
|
||||
}
|
||||
@ -1811,7 +1816,9 @@ dirvote_add_signatures_to_pending_consensus(
|
||||
tor_assert(src);
|
||||
strlcpy(dst, src, new_consensus_len - (dst-pending_consensus_body));
|
||||
|
||||
/* XXXX020 remove this block once it has failed to crash for a while. */
|
||||
/* We remove this block once it has failed to crash for a while. But
|
||||
* unless it shows up in profiles, we're probably better leaving it in,
|
||||
* just in case we break detached signature processing at some point. */
|
||||
{
|
||||
ns_detached_signatures_t *sigs =
|
||||
networkstatus_parse_detached_signatures(new_detached, NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user