mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-30 23:53:32 +01:00
fix bug: we were caching the newest descriptor for each server,
well, forever. i imagine this just keeps growing in size. svn:r5912
This commit is contained in:
parent
4c1fa73c7e
commit
53f86cdf5d
@ -1708,7 +1708,8 @@ routerlist_remove_old_routers(void)
|
|||||||
{
|
{
|
||||||
int i, hi=-1;
|
int i, hi=-1;
|
||||||
const char *cur_id = NULL;
|
const char *cur_id = NULL;
|
||||||
time_t now, cutoff;
|
time_t now = time(NULL);
|
||||||
|
time_t cutoff;
|
||||||
routerinfo_t *router;
|
routerinfo_t *router;
|
||||||
signed_descriptor_t *sd;
|
signed_descriptor_t *sd;
|
||||||
digestmap_t *retain;
|
digestmap_t *retain;
|
||||||
@ -1717,15 +1718,16 @@ routerlist_remove_old_routers(void)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
retain = digestmap_new();
|
retain = digestmap_new();
|
||||||
|
cutoff = now - OLD_ROUTER_DESC_MAX_AGE;
|
||||||
if (server_mode(options) && options->DirPort) {
|
if (server_mode(options) && options->DirPort) {
|
||||||
SMARTLIST_FOREACH(networkstatus_list, networkstatus_t *, ns,
|
SMARTLIST_FOREACH(networkstatus_list, networkstatus_t *, ns,
|
||||||
{
|
{
|
||||||
SMARTLIST_FOREACH(ns->entries, routerstatus_t *, rs,
|
SMARTLIST_FOREACH(ns->entries, routerstatus_t *, rs,
|
||||||
|
if (rs->published_on >= cutoff)
|
||||||
digestmap_set(retain, rs->descriptor_digest, (void*)1));
|
digestmap_set(retain, rs->descriptor_digest, (void*)1));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
now = time(NULL);
|
|
||||||
cutoff = now - ROUTER_MAX_AGE;
|
cutoff = now - ROUTER_MAX_AGE;
|
||||||
/* Remove too-old members of routerlist->routers. */
|
/* Remove too-old members of routerlist->routers. */
|
||||||
for (i = 0; i < smartlist_len(routerlist->routers); ++i) {
|
for (i = 0; i < smartlist_len(routerlist->routers); ++i) {
|
||||||
|
Loading…
Reference in New Issue
Block a user