tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

commit b67f3b751a277fb940b155c0bc64f594db5549b0
parent 88c9730817640fb5538d9c136286ecd09914eea7
Author: Nick Mathewson <nickm@torproject.org>
Date:   Fri, 14 Sep 2018 09:14:12 -0400

Merge branch 'ticket27247'

Diffstat:
Achanges/ticket27247 | 5+++++
Msrc/feature/control/control.c | 4+---
Msrc/feature/nodelist/networkstatus.c | 11++++++-----
3 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/changes/ticket27247 b/changes/ticket27247 @@ -0,0 +1,5 @@ + o Minor bugfixes (client, memory usage): + - When not running as a directory cache, there is no need to store the + text of the current consensus networkstatus in RAM. Previously, + however, clients would store this anyway, at a cost of over 5 MB. + Now, they do not. Fixes bug 27247; bugfix on 0.3.0.1-alpha. diff --git 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 @@ -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); } }