diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-04-16 10:38:55 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-04-22 19:42:26 -0400 |
commit | 948dd2c79ea9ca1fd06c13f275515a1745c46986 (patch) | |
tree | afc311f00bca225b6745b4778a73f38d741c6eb9 /src/or/entrynodes.c | |
parent | 22845df2a7503ed73ed325c3a98916f289918caa (diff) | |
download | tor-948dd2c79ea9ca1fd06c13f275515a1745c46986.tar.gz tor-948dd2c79ea9ca1fd06c13f275515a1745c46986.zip |
Check for "the right descriptor", not just "any descriptor".
This patch adds a new node_has_preferred_descriptor() function, and
replaces most users of node_has_descriptor() with it. That's an
important change, since as of d1874b433953f64 (our fix for #25213),
we are willing to say that a node has _some_ descriptor, but not the
_right_ descriptor for a particular use case.
Part of a fix for 25691 and 25692.
Diffstat (limited to 'src/or/entrynodes.c')
-rw-r--r-- | src/or/entrynodes.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c index 2b6ff38c9c..54638810fa 100644 --- a/src/or/entrynodes.c +++ b/src/or/entrynodes.c @@ -185,14 +185,14 @@ should_apply_guardfraction(const networkstatus_t *ns) return options->UseGuardFraction; } -/** Return true iff we know a descriptor for <b>guard</b> */ +/** Return true iff we know a preferred descriptor for <b>guard</b> */ static int guard_has_descriptor(const entry_guard_t *guard) { const node_t *node = node_get_by_id(guard->identity); if (!node) return 0; - return node_has_descriptor(node); + return node_has_preferred_descriptor(node, 1); } /** @@ -2269,7 +2269,8 @@ entry_guard_pick_for_circuit(guard_selection_t *gs, // XXXX #20827 check Ed ID. if (! node) goto fail; - if (BUG(usage != GUARD_USAGE_DIRGUARD && !node_has_descriptor(node))) + if (BUG(usage != GUARD_USAGE_DIRGUARD && + !node_has_preferred_descriptor(node, 1))) goto fail; *chosen_node_out = node; |