diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-04-28 21:25:24 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-04-28 21:25:24 -0400 |
commit | bcdffc0f80c0d5c9ed8c3858d95f351e14f9c722 (patch) | |
tree | 9e39717e562d85767d93d57fb4138852eaf92f7d | |
parent | 50c6b55757be615be828cec21d3178e8b0501e51 (diff) | |
download | tor-bcdffc0f80c0d5c9ed8c3858d95f351e14f9c722.tar.gz tor-bcdffc0f80c0d5c9ed8c3858d95f351e14f9c722.zip |
Rate-limit v2 networkstatus download fail warnings
This fixes part of 1352. We don't care deeply about these warnings,
since v2 networkstatuses aren't a big deal.
-rw-r--r-- | changes/bug1352 | 4 | ||||
-rw-r--r-- | src/or/directory.c | 16 |
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; |