summaryrefslogtreecommitdiff
path: root/src/feature
diff options
context:
space:
mode:
Diffstat (limited to 'src/feature')
-rw-r--r--src/feature/control/control.c4
-rw-r--r--src/feature/nodelist/networkstatus.c11
2 files changed, 7 insertions, 8 deletions
diff --git a/src/feature/control/control.c b/src/feature/control/control.c
index 2fac3bd6de..095ff8193b 100644
--- a/src/feature/control/control.c
+++ b/src/feature/control/control.c
@@ -2341,9 +2341,7 @@ getinfo_helper_dir(control_connection_t *control_conn,
*answer = tor_strdup(consensus->dir);
}
if (!*answer) { /* try loading it from disk */
- char *filename = get_cachedir_fname("cached-consensus");
- *answer = read_file_to_str(filename, RFTS_IGNORE_MISSING, NULL);
- tor_free(filename);
+ *answer = networkstatus_read_cached_consensus("ns");
if (!*answer) { /* generate an error */
*errmsg = "Could not open cached consensus. "
"Make sure FetchUselessDescriptors is set to 1.";
diff --git a/src/feature/nodelist/networkstatus.c b/src/feature/nodelist/networkstatus.c
index 6e386628d7..81da9756aa 100644
--- a/src/feature/nodelist/networkstatus.c
+++ b/src/feature/nodelist/networkstatus.c
@@ -2098,12 +2098,13 @@ networkstatus_set_current_consensus(const char *consensus,
}
if (we_want_to_fetch_flavor(options, flav)) {
- dirserv_set_cached_consensus_networkstatus(consensus,
- flavor,
- &c->digests,
- c->digest_sha3_as_signed,
- c->valid_after);
if (dir_server_mode(get_options())) {
+ dirserv_set_cached_consensus_networkstatus(consensus,
+ flavor,
+ &c->digests,
+ c->digest_sha3_as_signed,
+ c->valid_after);
+
consdiffmgr_add_consensus(consensus, c);
}
}