aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-03-10 14:08:38 -0400
committerNick Mathewson <nickm@torproject.org>2014-03-10 14:08:38 -0400
commitb8ceb464e5949b07ba9bd007002a49f3ab9c600b (patch)
treebda3db474b49de8a9c091bdd8cbac786a6eb5e67 /src
parent0c04416c11d79e8dc5fc9def6ea337f75526e397 (diff)
parent6606e676eeafd8ff848dfb247e2b675eed190698 (diff)
downloadtor-b8ceb464e5949b07ba9bd007002a49f3ab9c600b.tar
tor-b8ceb464e5949b07ba9bd007002a49f3ab9c600b.tar.gz
Merge branch 'bug11156_squashed'
Diffstat (limited to 'src')
-rw-r--r--src/or/microdesc.c2
-rw-r--r--src/or/networkstatus.c36
-rw-r--r--src/or/networkstatus.h2
-rw-r--r--src/or/nodelist.c8
-rw-r--r--src/or/routerlist.c6
5 files changed, 39 insertions, 15 deletions
diff --git a/src/or/microdesc.c b/src/or/microdesc.c
index 8052ca998..6419ea79f 100644
--- a/src/or/microdesc.c
+++ b/src/or/microdesc.c
@@ -721,7 +721,7 @@ update_microdesc_downloads(time_t now)
smartlist_t *missing;
digestmap_t *pending;
- if (should_delay_dir_fetches(options))
+ if (should_delay_dir_fetches(options, NULL))
return;
if (directory_too_idle_to_fetch_descriptors(options, now))
return;
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index 2b0242b56..49478a734 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);
diff --git a/src/or/networkstatus.h b/src/or/networkstatus.h
index df5895c4b..1659818f0 100644
--- a/src/or/networkstatus.h
+++ b/src/or/networkstatus.h
@@ -53,7 +53,7 @@ int networkstatus_nickname_is_unnamed(const char *nickname);
void networkstatus_consensus_download_failed(int status_code,
const char *flavname);
void update_consensus_networkstatus_fetch_time(time_t now);
-int should_delay_dir_fetches(const or_options_t *options);
+int should_delay_dir_fetches(const or_options_t *options,const char **msg_out);
void update_networkstatus_downloads(time_t now);
void update_certificate_downloads(time_t now);
int consensus_is_waiting_for_certs(void);
diff --git a/src/or/nodelist.c b/src/or/nodelist.c
index 737de92ee..3704822c7 100644
--- a/src/or/nodelist.c
+++ b/src/or/nodelist.c
@@ -1477,6 +1477,7 @@ update_router_have_minimum_dir_info(void)
const networkstatus_t *consensus =
networkstatus_get_reasonably_live_consensus(now,usable_consensus_flavor());
int using_md;
+ const char *delay_fetches_msg = NULL;
if (!consensus) {
if (!networkstatus_get_latest_consensus())
@@ -1489,10 +1490,9 @@ update_router_have_minimum_dir_info(void)
goto done;
}
- if (should_delay_dir_fetches(get_options())) {
- log_notice(LD_DIR, "no known bridge descriptors running yet; stalling");
- strlcpy(dir_info_status, "No live bridge descriptors.",
- sizeof(dir_info_status));
+ if (should_delay_dir_fetches(get_options(), &delay_fetches_msg)) {
+ log_notice(LD_DIR, "Delaying dir fetches: %s", delay_fetches_msg);
+ strlcpy(dir_info_status, "%s", sizeof(dir_info_status));
res = 0;
goto done;
}
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 49ea752ba..8d29b89ea 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -669,7 +669,7 @@ authority_certs_fetch_missing(networkstatus_t *status, time_t now)
char id_digest_str[2*DIGEST_LEN+1];
char sk_digest_str[2*DIGEST_LEN+1];
- if (should_delay_dir_fetches(get_options()))
+ if (should_delay_dir_fetches(get_options(), NULL))
return;
pending_cert = fp_pair_map_new();
@@ -4592,7 +4592,7 @@ void
update_router_descriptor_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;
if (!we_fetch_router_descriptors(options))
return;
@@ -4613,7 +4613,7 @@ update_extrainfo_downloads(time_t now)
int n_no_ei = 0, n_pending = 0, n_have = 0, n_delay = 0;
if (! options->DownloadExtraInfo)
return;
- if (should_delay_dir_fetches(options))
+ if (should_delay_dir_fetches(options, NULL))
return;
if (!router_have_minimum_dir_info())
return;