summaryrefslogtreecommitdiff
path: root/src/or/bridges.c
diff options
context:
space:
mode:
authorteor <teor2345@gmail.com>2017-09-11 13:56:35 +1000
committerNick Mathewson <nickm@torproject.org>2017-09-12 10:38:25 -0400
commit93a8ed3b83b5f20768562ca2aff4eba7aca667d8 (patch)
tree1d136ed005def091d9266d7985581c6fafe96180 /src/or/bridges.c
parent6370fb77c586e9ad68c7d1ecb95be36137cb9067 (diff)
downloadtor-93a8ed3b83b5f20768562ca2aff4eba7aca667d8.tar.gz
tor-93a8ed3b83b5f20768562ca2aff4eba7aca667d8.zip
Make clients wait to refresh bridges when they have a recent descriptor
But when clients are just starting, make them try each bridge a few times before giving up on it. These changes make the bridge download schedules more explicit: before 17750, they relied on undocumented behaviour and specific schedule entries. (And between 17750 and this fix, they were broken.) Fixes 23347, not in any released version of tor.
Diffstat (limited to 'src/or/bridges.c')
-rw-r--r--src/or/bridges.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/or/bridges.c b/src/or/bridges.c
index fc39ccaa94..257bb8920b 100644
--- a/src/or/bridges.c
+++ b/src/or/bridges.c
@@ -794,17 +794,10 @@ learned_bridge_descriptor(routerinfo_t *ri, int from_cache)
node_t *node;
/* it's here; schedule its re-fetch for a long time from now. */
if (!from_cache) {
+ /* This schedules the re-fetch at a constant interval, which produces
+ * a pattern of bridge traffic. But it's better than trying all
+ * configured briges several times in the first few minutes. */
download_status_reset(&bridge->fetch_status);
- /* We have two quick attempts in the bridge schedule, and then slow
- * ones */
- 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);
@@ -837,8 +830,8 @@ learned_bridge_descriptor(routerinfo_t *ri, int from_cache)
* We use this function to decide if we're ready to start building
* circuits through our bridges, or if we need to wait until the
* directory "server/authority" requests finish. */
-int
-any_bridge_descriptors_known(void)
+MOCK_IMPL(int,
+any_bridge_descriptors_known, (void))
{
tor_assert(get_options()->UseBridges);