diff options
author | George Kadianakis <desnacked@riseup.net> | 2014-03-08 13:13:12 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-03-10 14:07:56 -0400 |
commit | 6606e676eeafd8ff848dfb247e2b675eed190698 (patch) | |
tree | f88b50015a34bc55d4ed48c787675f564f349a7f /src/or/networkstatus.c | |
parent | 0b7a66fac76445087651a1dd2d171bf043c9f345 (diff) | |
download | tor-6606e676eeafd8ff848dfb247e2b675eed190698.tar.gz tor-6606e676eeafd8ff848dfb247e2b675eed190698.zip |
Don't do directory fetches before all PTs have been configured.
Diffstat (limited to 'src/or/networkstatus.c')
-rw-r--r-- | src/or/networkstatus.c | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c index 2b0242b569..49478a7341 100644 --- a/src/or/networkstatus.c +++ b/src/or/networkstatus.c @@ -31,6 +31,7 @@ #include "router.h" #include "routerlist.h" #include "routerparse.h" +#include "transports.h" /** Map from lowercase nickname to identity digest of named server, if any. */ static strmap_t *named_server_map = NULL; @@ -884,14 +885,37 @@ update_consensus_networkstatus_fetch_time(time_t now) /** Return 1 if there's a reason we shouldn't try any directory * fetches yet (e.g. we demand bridges and none are yet known). - * Else return 0. */ + * Else return 0. + + * If we return 1 and <b>msg_out</b> is provided, set <b>msg_out</b> + * to an explanation of why directory fetches are delayed. (If we + * return 0, we set msg_out to NULL.) + */ int -should_delay_dir_fetches(const or_options_t *options) +should_delay_dir_fetches(const or_options_t *options, const char **msg_out) { - if (options->UseBridges && !any_bridge_descriptors_known()) { - log_info(LD_DIR, "delaying dir fetches (no running bridges known)"); - return 1; + if (msg_out) { + *msg_out = NULL; } + + if (options->UseBridges) { + if (!any_bridge_descriptors_known()) { + if (msg_out) { + *msg_out = "No running bridges"; + } + log_info(LD_DIR, "Delaying dir fetches (no running bridges known)"); + return 1; + } + + if (pt_proxies_configuration_pending()) { + if (msg_out) { + *msg_out = "Pluggable transport proxies still configuring"; + } + log_info(LD_DIR, "Delaying dir fetches (pt proxies still configuring)"); + return 1; + } + } + return 0; } @@ -901,7 +925,7 @@ void update_networkstatus_downloads(time_t now) { const or_options_t *options = get_options(); - if (should_delay_dir_fetches(options)) + if (should_delay_dir_fetches(options, NULL)) return; update_consensus_networkstatus_downloads(now); update_certificate_downloads(now); |