mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Use networkstatus_read_cached_consensus() for GETINFO
We already had fallback code for "dir/status-vote/current/consensus" to read from disk if we didn't have a cached_dir_t available. But there's a function in networkstatus_t that does it for us, so let's do that.
This commit is contained in:
@@ -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.";
|
||||
|
||||
Reference in New Issue
Block a user