aboutsummaryrefslogtreecommitdiff
path: root/src/feature/dirclient/dirclient.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/feature/dirclient/dirclient.c')
-rw-r--r--src/feature/dirclient/dirclient.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/feature/dirclient/dirclient.c b/src/feature/dirclient/dirclient.c
index f088ef8283..74e68ac6be 100644
--- a/src/feature/dirclient/dirclient.c
+++ b/src/feature/dirclient/dirclient.c
@@ -1987,7 +1987,7 @@ dirclient_dump_total_dls(void)
{
const or_options_t *options = get_options();
for (int bootstrapped = 0; bootstrapped < 2; ++bootstrapped) {
- bool first_time = true;
+ smartlist_t *lines = smartlist_new();
for (int i=0; i < DIR_PURPOSE_MAX_; ++i) {
uint64_t n = total_dl[i][bootstrapped];
if (n == 0)
@@ -1995,15 +1995,19 @@ dirclient_dump_total_dls(void)
if (options->SafeLogging_ != SAFELOG_SCRUB_NONE &&
purpose_needs_anonymity(i, ROUTER_PURPOSE_GENERAL, NULL))
continue;
- if (first_time) {
- log_notice(LD_NET,
- "While %sbootstrapping, fetched this many bytes: ",
- bootstrapped?"not ":"");
- first_time = false;
- }
- log_notice(LD_NET, " %"PRIu64" (%s)",
- n, dir_conn_purpose_to_string(i));
+ smartlist_add_asprintf(lines, "%"PRIu64" (%s)",
+ n, dir_conn_purpose_to_string(i));
+ }
+
+ if (smartlist_len(lines) > 0) {
+ char *log_line = smartlist_join_strings(lines, "; ", 0, NULL);
+ log_notice(LD_NET, "While %sbootstrapping, fetched this many bytes: %s",
+ bootstrapped?"not ":"", log_line);
+ tor_free(log_line);
+
+ SMARTLIST_FOREACH(lines, char *, s, tor_free(s));
}
+ smartlist_free(lines);
}
}
@@ -2505,9 +2509,12 @@ handle_response_fetch_desc(dir_connection_t *conn,
}
if (status_code != 200) {
int dir_okay = status_code == 404 ||
- (status_code == 400 && !strcmp(reason, "Servers unavailable."));
+ (status_code == 400 && !strcmp(reason, "Servers unavailable.")) ||
+ status_code == 301;
/* 404 means that it didn't have them; no big deal.
- * Older (pre-0.1.1.8) servers said 400 Servers unavailable instead. */
+ * Older (pre-0.1.1.8) servers said 400 Servers unavailable instead.
+ * 301 is considered as an error since Tor does not follow redirects,
+ * which means we failed to reach the server we wanted. */
log_fn(dir_okay ? LOG_INFO : LOG_WARN, LD_DIR,
"Received http status code %d (%s) from server %s "
"while fetching \"/tor/server/%s\". I'll try again soon.",