[or-cvs] r12103: Download some XXXX020s in dirvote.c and mark some functions (in tor/trunk: . src/or)
nickm at seul.org
nickm at seul.org
Mon Oct 22 16:32:07 UTC 2007
Author: nickm
Date: 2007-10-22 12:32:06 -0400 (Mon, 22 Oct 2007)
New Revision: 12103
Modified:
tor/trunk/
tor/trunk/src/or/directory.c
tor/trunk/src/or/dirvote.c
Log:
r16033 at catbus: nickm | 2007-10-22 12:26:13 -0400
Download some XXXX020s in dirvote.c and mark some functions that may not belong there.
Property changes on: tor/trunk
___________________________________________________________________
svk:merge ticket from /tor/trunk [r16033] on 8246c3cf-6607-4228-993b-4d95d33730f1
Modified: tor/trunk/src/or/directory.c
===================================================================
--- tor/trunk/src/or/directory.c 2007-10-22 16:32:04 UTC (rev 12102)
+++ tor/trunk/src/or/directory.c 2007-10-22 16:32:06 UTC (rev 12103)
@@ -509,8 +509,12 @@
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 @@
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 @@
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 @@
// 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);
Modified: tor/trunk/src/or/dirvote.c
===================================================================
--- tor/trunk/src/or/dirvote.c 2007-10-22 16:32:04 UTC (rev 12102)
+++ tor/trunk/src/or/dirvote.c 2007-10-22 16:32:06 UTC (rev 12103)
@@ -28,6 +28,7 @@
* 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 @@
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 @@
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 @@
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 @@
* 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 @@
!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_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 @@
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);
More information about the tor-commits
mailing list