diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-06-26 13:20:54 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-06-26 13:27:50 -0400 |
commit | ebbb0348dc3ad57f6be8208a90f3c2fd9fe2cbf7 (patch) | |
tree | bb64d4cdd2913bc17f8f559c360824caa90e33a8 /src/or | |
parent | bf89278c799e718a3b6c1ea139a6069db054ac09 (diff) | |
download | tor-ebbb0348dc3ad57f6be8208a90f3c2fd9fe2cbf7.tar.gz tor-ebbb0348dc3ad57f6be8208a90f3c2fd9fe2cbf7.zip |
Finish renaming digestset_contains to digestset_probably_contains
Since bloom filters are probabilistic, it's nice to make it clear
that the "contains" operation can have false positives.
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/entrynodes.c | 2 | ||||
-rw-r--r-- | src/or/routerlist.c | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c index 9d27d80a84..47e689b5cb 100644 --- a/src/or/entrynodes.c +++ b/src/or/entrynodes.c @@ -1065,7 +1065,7 @@ get_eligible_guards(const or_options_t *options, continue; } ++n_guards; - if (digestset_contains(sampled_guard_ids, node->identity)) + if (digestset_probably_contains(sampled_guard_ids, node->identity)) continue; smartlist_add(eligible_guards, (node_t*)node); } SMARTLIST_FOREACH_END(node); diff --git a/src/or/routerlist.c b/src/or/routerlist.c index a7dda68a56..66967f13f5 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -4116,7 +4116,8 @@ routerlist_remove_old_cached_routers_with_id(time_t now, signed_descriptor_t *r_next; lifespans[i-lo].idx = i; if (r->last_listed_as_valid_until >= now || - (retain && digestset_contains(retain, r->signed_descriptor_digest))) { + (retain && digestset_probably_contains(retain, + r->signed_descriptor_digest))) { must_keep[i-lo] = 1; } if (i < hi) { @@ -4211,7 +4212,7 @@ routerlist_remove_old_routers(void) router = smartlist_get(routerlist->routers, i); if (router->cache_info.published_on <= cutoff && router->cache_info.last_listed_as_valid_until < now && - !digestset_contains(retain, + !digestset_probably_contains(retain, router->cache_info.signed_descriptor_digest)) { /* Too old: remove it. (If we're a cache, just move it into * old_routers.) */ @@ -4232,7 +4233,7 @@ routerlist_remove_old_routers(void) sd = smartlist_get(routerlist->old_routers, i); if (sd->published_on <= cutoff && sd->last_listed_as_valid_until < now && - !digestset_contains(retain, sd->signed_descriptor_digest)) { + !digestset_probably_contains(retain, sd->signed_descriptor_digest)) { /* Too old. Remove it. */ routerlist_remove_old(routerlist, sd, i--); } |