[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Use networkstatus_read_cached_consensus() for GETINFO



commit 95060eacaeae4a32f0c478ca27f81e48d5daee8b
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Fri Sep 7 19:31:53 2018 -0400

    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.
---
 src/feature/control/control.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/feature/control/control.c b/src/feature/control/control.c
index 9e7d21308..507afb950 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.";



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits