aboutsummaryrefslogtreecommitdiff
path: root/src/or/networkstatus.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-12-16 20:04:49 -0500
committerNick Mathewson <nickm@torproject.org>2015-12-16 20:04:49 -0500
commitb9714e1366a19dff1f9abe18a22dc4367788cc3c (patch)
tree6badd97223a7ca313a6f3ed5591952f0c713801f /src/or/networkstatus.c
parente6be486aea1a102d73c4432340c533eea80740e1 (diff)
parent1b704979488fad24bc439b52e7392e6936955577 (diff)
downloadtor-b9714e1366a19dff1f9abe18a22dc4367788cc3c.tar.gz
tor-b9714e1366a19dff1f9abe18a22dc4367788cc3c.zip
Merge remote-tracking branch 'teor/fix-multi-dir'
Diffstat (limited to 'src/or/networkstatus.c')
-rw-r--r--src/or/networkstatus.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index 173c109d60..0cf8873f03 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -1286,25 +1286,29 @@ networkstatus_consensus_is_boostrapping(time_t now)
}
/** Check if we can use multiple directories for a consensus download.
- * Only clients (including bridges, but excluding bridge clients) benefit
+ * Only clients (including bridge relays, which act like clients) benefit
* from multiple simultaneous consensus downloads. */
int
networkstatus_consensus_can_use_multiple_directories(
const or_options_t *options)
{
/* If we are a client, bridge, bridge client, or hidden service */
- return (!directory_fetches_from_authorities(options));
+ return !public_server_mode(options);
}
/** Check if we can use fallback directory mirrors for a consensus download.
- * Only clients that have a list of additional fallbacks can use fallbacks. */
+ * If we have fallbacks and don't want to fetch from the authorities,
+ * we can use them. */
int
networkstatus_consensus_can_use_extra_fallbacks(const or_options_t *options)
{
- /* If we are a client, and we have additional mirrors, we can use them.
- * The list length comparisons are a quick way to check if we have any
+ /* The list length comparisons are a quick way to check if we have any
* non-authority fallback directories. If we ever have any authorities that
* aren't fallback directories, we will need to change this code. */
+ tor_assert(smartlist_len(router_get_fallback_dir_servers())
+ >= smartlist_len(router_get_trusted_dir_servers()));
+ /* If we don't fetch from the authorities, and we have additional mirrors,
+ * we can use them. */
return (!directory_fetches_from_authorities(options)
&& (smartlist_len(router_get_fallback_dir_servers())
> smartlist_len(router_get_trusted_dir_servers())));