summaryrefslogtreecommitdiff
path: root/src/or/networkstatus.c
diff options
context:
space:
mode:
authorteor (Tim Wilson-Brown) <teor2345@gmail.com>2015-12-17 11:39:40 +1100
committerteor (Tim Wilson-Brown) <teor2345@gmail.com>2015-12-17 11:39:40 +1100
commite7e61ec7ec32b4aa874a38991358812438405d96 (patch)
tree519160d47b7e03dc3b2e2b9576d840afe48d5a43 /src/or/networkstatus.c
parent9882a88b7457c48fb5ce48259a862593e7a2b309 (diff)
downloadtor-e7e61ec7ec32b4aa874a38991358812438405d96.tar.gz
tor-e7e61ec7ec32b4aa874a38991358812438405d96.zip
Prop210: Check fallback directories and authorities work as expected
Also clarify comments.
Diffstat (limited to 'src/or/networkstatus.c')
-rw-r--r--src/or/networkstatus.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index 584569a108..0cf8873f03 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -1297,14 +1297,18 @@ networkstatus_consensus_can_use_multiple_directories(
}
/** 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())));