aboutsummaryrefslogtreecommitdiff
path: root/src/or/networkstatus.c
diff options
context:
space:
mode:
authorteor <teor2345@gmail.com>2016-11-30 11:06:36 +1100
committerteor <teor2345@gmail.com>2016-11-30 11:06:36 +1100
commite5c608e535ef9a4c4fe951a277e3891c77de4908 (patch)
treeb3c9f04fdd2d60f2d6b5172a68f12479c2203add /src/or/networkstatus.c
parent4614f8e6816d559f8fbe9ae0f42d751d3fb95c77 (diff)
downloadtor-e5c608e535ef9a4c4fe951a277e3891c77de4908.tar.gz
tor-e5c608e535ef9a4c4fe951a277e3891c77de4908.zip
Stop discarding consensus flavors and descriptors we wanted to fetch
Instead, fetch and store consensus flavors and descriptors we wanted to fetch. And serve them if we are a directory cache (or authority).
Diffstat (limited to 'src/or/networkstatus.c')
-rw-r--r--src/or/networkstatus.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index 316ce48387..6cbcaf8c01 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -814,8 +814,11 @@ networkstatus_nickname_is_unnamed(const char *nickname)
#define NONAUTHORITY_NS_CACHE_INTERVAL (60*60)
/** Return true iff, given the options listed in <b>options</b>, <b>flavor</b>
- * is the flavor of a consensus networkstatus that we would like to fetch. */
-static int
+ * is the flavor of a consensus networkstatus that we would like to fetch.
+ *
+ * For certificate fetches, use we_want_to_fetch_unknown_auth_certs, and
+ * for serving fetched documents, use directory_caches_dir_info. */
+int
we_want_to_fetch_flavor(const or_options_t *options, int flavor)
{
if (flavor < 0 || flavor > N_CONSENSUS_FLAVORS) {
@@ -1728,9 +1731,9 @@ networkstatus_set_current_consensus(const char *consensus,
}
if (flav != usable_consensus_flavor() &&
- !directory_caches_dir_info(options)) {
- /* This consensus is totally boring to us: we won't use it, and we won't
- * serve it. Drop it. */
+ !we_want_to_fetch_flavor(options, flav)) {
+ /* This consensus is totally boring to us: we won't use it, we didn't want
+ * it, and we won't serve it. Drop it. */
goto done;
}
@@ -1932,7 +1935,7 @@ networkstatus_set_current_consensus(const char *consensus,
download_status_failed(&consensus_dl_status[flav], 0);
}
- if (directory_caches_dir_info(options)) {
+ if (we_want_to_fetch_flavor(options, flav)) {
dirserv_set_cached_consensus_networkstatus(consensus,
flavor,
&c->digests,