summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changes/bug13524
-rw-r--r--src/or/directory.c16
2 files changed, 15 insertions, 5 deletions
diff --git a/changes/bug1352 b/changes/bug1352
new file mode 100644
index 0000000000..bde0192401
--- /dev/null
+++ b/changes/bug1352
@@ -0,0 +1,4 @@
+ o Minor features
+ - Rate-limit a warning about failures to download v2 networkstatus
+ documents. Resolves part of bug 1352.
+
diff --git a/src/or/directory.c b/src/or/directory.c
index 2ac78111d7..972dec5bea 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -1647,11 +1647,17 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
log_info(LD_DIR,"Received networkstatus objects (size %d) from server "
"'%s:%d'", (int)body_len, conn->_base.address, conn->_base.port);
if (status_code != 200) {
- log_warn(LD_DIR,
- "Received http status code %d (%s) from server "
- "'%s:%d' while fetching \"/tor/status/%s\". I'll try again soon.",
- status_code, escaped(reason), conn->_base.address,
- conn->_base.port, conn->requested_resource);
+ static ratelim_t warning_limit = RATELIM_INIT(3600);
+ char *m;
+ if ((m = rate_limit_log(&warning_limit, now))) {
+ log_warn(LD_DIR,
+ "Received http status code %d (%s) from server "
+ "'%s:%d' while fetching \"/tor/status/%s\". "
+ "I'll try again soon.%s",
+ status_code, escaped(reason), conn->_base.address,
+ conn->_base.port, conn->requested_resource, m);
+ tor_free(m);
+ }
tor_free(body); tor_free(headers); tor_free(reason);
connection_dir_download_v2_networkstatus_failed(conn, status_code);
return -1;