diff options
author | Roger Dingledine <arma@torproject.org> | 2007-11-03 15:55:15 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2007-11-03 15:55:15 +0000 |
commit | d4e339ed879ef60e645a2b2d1fea87aaecc342fe (patch) | |
tree | da81927c055711783ea349020c5e70304220ee42 /src | |
parent | 23fdfd4dcff24d45c78ffcae7d9dc5398b0c2150 (diff) | |
download | tor-d4e339ed879ef60e645a2b2d1fea87aaecc342fe.tar.gz tor-d4e339ed879ef60e645a2b2d1fea87aaecc342fe.zip |
Nov 03 11:15:13.103 [info] connection_dir_client_reached_eof(): Received consensus directory (size 330543) from server '86.59.21.38:80'
Nov 03 11:15:13.129 [info] networkstatus_set_current_consensus(): Got a consensus we already have
Nov 03 11:15:13.129 [warn] Unable to load consensus directory dowloaded from server '86.59.21.38:80'
svn:r12359
Diffstat (limited to 'src')
-rw-r--r-- | src/or/directory.c | 8 | ||||
-rw-r--r-- | src/or/networkstatus.c | 19 | ||||
-rw-r--r-- | src/or/routerparse.c | 2 |
3 files changed, 20 insertions, 9 deletions
diff --git a/src/or/directory.c b/src/or/directory.c index c249af732e..7d58ad8af5 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -1455,6 +1455,7 @@ connection_dir_client_reached_eof(dir_connection_t *conn) } if (conn->_base.purpose == DIR_PURPOSE_FETCH_CONSENSUS) { + int r; if (status_code != 200) { int severity = (status_code == 304) ? LOG_INFO : LOG_WARN; log(severity, LD_DIR, @@ -1468,9 +1469,10 @@ connection_dir_client_reached_eof(dir_connection_t *conn) } log_info(LD_DIR,"Received consensus directory (size %d) from server " "'%s:%d'",(int) body_len, conn->_base.address, conn->_base.port); - if (networkstatus_set_current_consensus(body, 0, 0)<0) { - log_warn(LD_DIR, "Unable to load consensus directory dowloaded from " - "server '%s:%d'", conn->_base.address, conn->_base.port); + if ((r=networkstatus_set_current_consensus(body, 0, 0))<0) { + log_fn(r<-1?LOG_WARN:LOG_INFO, LD_DIR, + "Unable to load consensus directory downloaded from " + "server '%s:%d'", conn->_base.address, conn->_base.port); tor_free(body); tor_free(headers); tor_free(reason); networkstatus_consensus_download_failed(0); return -1; diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c index 7113183112..f08cf5334e 100644 --- a/src/or/networkstatus.c +++ b/src/or/networkstatus.c @@ -1210,15 +1210,18 @@ networkstatus_copy_old_consensus_info(networkstatus_vote_t *new_c, * <b>consensus</b>. If we don't have enough certificates to validate it, * store it in consensus_waiting_for_certs and launch a certificate fetch. * - * Return 0 on success, -1 on failure. On -1, caller should increment + * Return 0 on success, <0 on failure. On failure, caller should increment * the failure count as appropriate. + * + * We return -1 for mild failures that don't need to be reported to the + * user, and -2 for more serious problems. */ int networkstatus_set_current_consensus(const char *consensus, int from_cache, int was_waiting_for_certs) { networkstatus_vote_t *c; - int r, result=-1; + int r, result = -1; time_t now = time(NULL); char *unverified_fname = NULL, *consensus_fname = NULL; @@ -1226,6 +1229,7 @@ networkstatus_set_current_consensus(const char *consensus, int from_cache, c = networkstatus_parse_vote_from_string(consensus, NULL, 0); if (!c) { log_warn(LD_DIR, "Unable to parse networkstatus consensus"); + result = -2; goto done; } @@ -1251,9 +1255,12 @@ networkstatus_set_current_consensus(const char *consensus, int from_cache, if ((r=networkstatus_check_consensus_signature(c, 1))<0) { if (r == -1 && !was_waiting_for_certs) { /* Okay, so it _might_ be signed enough if we get more certificates. */ - if (!was_waiting_for_certs) + if (!was_waiting_for_certs) { + /* XXX020 eventually downgrade this log severity, or make it so + * users know why they're being told. */ log_notice(LD_DIR, "Not enough certificates to check networkstatus " "consensus"); + } if (!current_consensus || c->valid_after > current_consensus->valid_after) { if (consensus_waiting_for_certs) @@ -1277,11 +1284,13 @@ networkstatus_set_current_consensus(const char *consensus, int from_cache, unlink(unverified_fname); } goto done; - } else { + } else { /* This can never be signed enough: Kill it. */ - if (!was_waiting_for_certs) + if (!was_waiting_for_certs) { log_warn(LD_DIR, "Not enough good signatures on networkstatus " "consensus"); + result = -2; + } if (was_waiting_for_certs && (r < -1) && from_cache) unlink(unverified_fname); goto done; diff --git a/src/or/routerparse.c b/src/or/routerparse.c index 1e86f8c6f3..ebf9266641 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -3309,7 +3309,7 @@ rend_parse_v2_service_descriptor(rend_service_descriptor_t **parsed_out, * valid numbers. -KL */ /* As above, increased version numbers are for * non-backward-compatible changes. This code doesn't know how to - * parse a v3 descriptor, because a v3 descriptor is by definitition not + * parse a v3 descriptor, because a v3 descriptor is by definition not * compatible with this code. */ version = atoi(smartlist_get(versions, i)); result->protocols |= 1 << version; |