diff options
author | teor <teor2345@gmail.com> | 2017-08-29 15:25:33 +1000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-09-12 10:38:25 -0400 |
commit | 6370fb77c586e9ad68c7d1ecb95be36137cb9067 (patch) | |
tree | 4991dfe830f592f7eb6edda1d7c17e2ee5c350fa /src/or/bridges.c | |
parent | 97249c4f5e389141cb4ff3562a3813bd09bff6ad (diff) | |
download | tor-6370fb77c586e9ad68c7d1ecb95be36137cb9067.tar.gz tor-6370fb77c586e9ad68c7d1ecb95be36137cb9067.zip |
Refactor bridge download statuses to increment on attempt
We were always incrementing bridge download statuses on each attempt,
but we were using the "increment on failure" functions to do it.
And we never incremented them on failure.
No behaviour change.
Diffstat (limited to 'src/or/bridges.c')
-rw-r--r-- | src/or/bridges.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/or/bridges.c b/src/or/bridges.c index f2244004f3..fc39ccaa94 100644 --- a/src/or/bridges.c +++ b/src/or/bridges.c @@ -454,6 +454,7 @@ bridge_add_from_config(bridge_line_t *bridge_line) b->transport_name = bridge_line->transport_name; b->fetch_status.schedule = DL_SCHED_BRIDGE; b->fetch_status.backoff = DL_SCHED_RANDOM_EXPONENTIAL; + b->fetch_status.increment_on = DL_SCHED_INCREMENT_ATTEMPT; b->socks_args = bridge_line->socks_args; if (!bridge_list) bridge_list = smartlist_new(); @@ -632,10 +633,13 @@ fetch_bridge_descriptors(const or_options_t *options, time_t now) continue; } - /* schedule another fetch as if this one will fail, in case it does - * (we can't increment after a failure, because sometimes we use the - * bridge authority, and sometimes we use the bridge direct) */ - download_status_failed(&bridge->fetch_status, 0); + /* schedule the next attempt + * we can't increment after a failure, because sometimes we use the + * bridge authority, and sometimes we use the bridge direct */ + download_status_increment_attempt( + &bridge->fetch_status, + safe_str_client(fmt_and_decorate_addr(&bridge->addr)), + now); can_use_bridge_authority = !tor_digest_is_zero(bridge->identity) && num_bridge_auths; @@ -793,8 +797,14 @@ learned_bridge_descriptor(routerinfo_t *ri, int from_cache) download_status_reset(&bridge->fetch_status); /* We have two quick attempts in the bridge schedule, and then slow * ones */ - download_status_failed(&bridge->fetch_status, 0); - download_status_failed(&bridge->fetch_status, 0); + download_status_increment_attempt( + &bridge->fetch_status, + safe_str_client(fmt_and_decorate_addr(&bridge->addr)), + now); + download_status_increment_attempt( + &bridge->fetch_status, + safe_str_client(fmt_and_decorate_addr(&bridge->addr)), + now); } node = node_get_mutable_by_id(ri->cache_info.identity_digest); |