mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 21:23:58 +01:00
Do not store cached_dir_t for consensus in RAM if not a dircache.
There are three reasons we use a cached_dir_t to hold a consensus:
1. to serve that consensus to a client
2. to apply a consensus diff to an existing consensus
3. to send the consensus to a controller.
But case 1 is dircache-only. Case 2 and case 3 both fall back to
networkstatus_read_cached_consensus(). So there's no reason for us
to store this as a client. Avoiding this saves about 23% of our RAM
usage, according to our experiments last month.
This is, semantically, a partial revert of e5c608e535
.
Fixes bug 27247; bugfix on 0.3.0.1-alpha.
This commit is contained in:
parent
95060eacae
commit
33a0c619a8
5
changes/ticket27247
Normal file
5
changes/ticket27247
Normal file
@ -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.
|
@ -2098,12 +2098,13 @@ networkstatus_set_current_consensus(const char *consensus,
|
||||
}
|
||||
|
||||
if (we_want_to_fetch_flavor(options, flav)) {
|
||||
if (dir_server_mode(get_options())) {
|
||||
dirserv_set_cached_consensus_networkstatus(consensus,
|
||||
flavor,
|
||||
&c->digests,
|
||||
c->digest_sha3_as_signed,
|
||||
c->valid_after);
|
||||
if (dir_server_mode(get_options())) {
|
||||
|
||||
consdiffmgr_add_consensus(consensus, c);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user