diff options
author | Nick Mathewson <nickm@torproject.org> | 2005-09-18 04:15:39 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2005-09-18 04:15:39 +0000 |
commit | 283032960d8c94b054997cd8db31aaca2c86eaad (patch) | |
tree | cfd3601ee2a063c423e7507ee28eb2c657120244 /src/or/directory.c | |
parent | d118d5069a183574c8d03a7e9e5559e47a9ddaa4 (diff) | |
download | tor-283032960d8c94b054997cd8db31aaca2c86eaad.tar.gz tor-283032960d8c94b054997cd8db31aaca2c86eaad.zip |
Make give-up-on-failure actually work: it seems the servers gave me a real test case.
svn:r5091
Diffstat (limited to 'src/or/directory.c')
-rw-r--r-- | src/or/directory.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/src/or/directory.c b/src/or/directory.c index 3bf2cf857d..946557ab9f 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -973,22 +973,27 @@ connection_dir_client_reached_eof(connection_t *conn) int n_asked_for = 0; log_fn(LOG_INFO,"Received server info (size %d) from server '%s:%d'", (int)body_len, conn->address, conn->port); - if (status_code != 200) { - log_fn(LOG_WARN,"Received http status code %d (\"%s\") from server '%s:%d' while fetching \"/tor/server/%s\". I'll try again soon.", - status_code, reason, conn->address, conn->port, - conn->requested_resource); - tor_free(body); tor_free(headers); tor_free(reason); - connection_dir_download_routerdesc_failed(conn); - return -1; - } if (conn->requested_resource && !strcmpstart(conn->requested_resource,"fp/")) { which = smartlist_create(); dir_split_resource_into_fingerprints(conn->requested_resource+3, which, NULL); - } - if (which) n_asked_for = smartlist_len(which); + } + if (status_code != 200) { + log_fn(LOG_WARN,"Received http status code %d (\"%s\") from server '%s:%d' while fetching \"/tor/server/%s\". I'll try again soon.", + status_code, reason, conn->address, conn->port, + conn->requested_resource); + tor_free(body); tor_free(headers); tor_free(reason); + if (!which) { + connection_dir_download_routerdesc_failed(conn); + } else { + dir_routerdesc_download_failed(which); + SMARTLIST_FOREACH(which, char *, cp, tor_free(cp)); + smartlist_free(which); + return -1; + } + } router_load_routers_from_string(body, 0, which); directory_info_has_arrived(time(NULL),0); if (which) { @@ -1548,9 +1553,12 @@ dir_networkstatus_download_failed(smartlist_t *failed) static void dir_routerdesc_download_failed(smartlist_t *failed) { + char digest[DIGEST_LEN]; + routerstatus_t *rs; SMARTLIST_FOREACH(failed, const char *, cp, { - routerstatus_t *rs = router_get_combined_status_by_digest(cp); + base16_decode(digest, DIGEST_LEN, cp, strlen(cp)); + rs = router_get_combined_status_by_digest(digest); if (!rs || rs->n_download_failures >= MAX_ROUTERDESC_DOWNLOAD_FAILURES) continue; ++rs->n_download_failures; |