diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-05-12 00:14:44 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-05-12 00:14:44 -0400 |
commit | 3968e8d14b7f6282963223b0fd4f4ca3afb60c61 (patch) | |
tree | 3cd2fa45008d855de9390836dd6347793425f557 /src/or/directory.c | |
parent | 7649adbce60c7ab615e233f9e9ce41c22df8134c (diff) | |
parent | b47f574c1e27b8665e9e2658409645a3831e7aa4 (diff) | |
download | tor-3968e8d14b7f6282963223b0fd4f4ca3afb60c61.tar.gz tor-3968e8d14b7f6282963223b0fd4f4ca3afb60c61.zip |
Merge remote-tracking branch 'origin/maint-0.2.2'
Diffstat (limited to 'src/or/directory.c')
-rw-r--r-- | src/or/directory.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/or/directory.c b/src/or/directory.c index 313c6c5a40..2821619ce7 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -66,7 +66,7 @@ static int purpose_needs_anonymity(uint8_t dir_purpose, uint8_t router_purpose); static char *http_get_header(const char *headers, const char *which); static void http_set_address_origin(const char *headers, connection_t *conn); -static void connection_dir_download_networkstatus_failed( +static void connection_dir_download_v2_networkstatus_failed( dir_connection_t *conn, int status_code); static void connection_dir_download_routerdesc_failed(dir_connection_t *conn); static void connection_dir_bridge_routerdesc_failed(dir_connection_t *conn); @@ -650,7 +650,7 @@ connection_dir_request_failed(dir_connection_t *conn) if (conn->_base.purpose == DIR_PURPOSE_FETCH_V2_NETWORKSTATUS) { log_info(LD_DIR, "Giving up on directory server at '%s'; retrying", conn->_base.address); - connection_dir_download_networkstatus_failed(conn, -1); + connection_dir_download_v2_networkstatus_failed(conn, -1); } else if (conn->_base.purpose == DIR_PURPOSE_FETCH_SERVERDESC || conn->_base.purpose == DIR_PURPOSE_FETCH_EXTRAINFO) { log_info(LD_DIR, "Giving up on serverdesc/extrainfo fetch from " @@ -685,7 +685,7 @@ connection_dir_request_failed(dir_connection_t *conn) * retry the fetch now, later, or never. */ static void -connection_dir_download_networkstatus_failed(dir_connection_t *conn, +connection_dir_download_v2_networkstatus_failed(dir_connection_t *conn, int status_code) { if (!conn->requested_resource) { @@ -1713,13 +1713,19 @@ 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_networkstatus_failed(conn, status_code); + connection_dir_download_v2_networkstatus_failed(conn, status_code); return -1; } if (conn->requested_resource && |