aboutsummaryrefslogtreecommitdiff
path: root/src/or/hs_common.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-04-22 19:44:27 -0400
committerNick Mathewson <nickm@torproject.org>2018-04-22 19:44:27 -0400
commit6773102c92e7bd9d949251da75bcc0762e754ab2 (patch)
tree310631258357320bbee56d488b6397d5facbb554 /src/or/hs_common.c
parentd8ac7d557c0af199d21639a52a8c8c9dd201f555 (diff)
parent0941c8bfe6f34024153ae3ed67e4b1a05f9a6bfe (diff)
downloadtor-6773102c92e7bd9d949251da75bcc0762e754ab2.tar.gz
tor-6773102c92e7bd9d949251da75bcc0762e754ab2.zip
Merge branch 'bug25691_033_again_squashed'
Diffstat (limited to 'src/or/hs_common.c')
-rw-r--r--src/or/hs_common.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/or/hs_common.c b/src/or/hs_common.c
index aa34b0e8fb..24eb7a104a 100644
--- a/src/or/hs_common.c
+++ b/src/or/hs_common.c
@@ -1279,8 +1279,10 @@ node_has_hsdir_index(const node_t *node)
tor_assert(node_supports_v3_hsdir(node));
/* A node can't have an HSDir index without a descriptor since we need desc
- * to get its ed25519 key */
- if (!node_has_descriptor(node)) {
+ * to get its ed25519 key. for_direct_connect should be zero, since we
+ * always use the consensus-indexed node's keys to build the hash ring, even
+ * if some of the consensus-indexed nodes are also bridges. */
+ if (!node_has_preferred_descriptor(node, 0)) {
return 0;
}
@@ -1611,12 +1613,17 @@ hs_pick_hsdir(smartlist_t *responsible_dirs, const char *req_key_str)
hs_clean_last_hid_serv_requests(now);
/* Only select those hidden service directories to which we did not send a
- * request recently and for which we have a router descriptor here. */
+ * request recently and for which we have a router descriptor here.
+ *
+ * Use for_direct_connect==0 even if we will be connecting to the node
+ * directly, since we always use the key information in the
+ * consensus-indexed node descriptors for building the index.
+ **/
SMARTLIST_FOREACH_BEGIN(responsible_dirs, routerstatus_t *, dir) {
time_t last = hs_lookup_last_hid_serv_request(dir, req_key_str, 0, 0);
const node_t *node = node_get_by_id(dir->identity_digest);
if (last + hs_hsdir_requery_period(options) >= now ||
- !node || !node_has_descriptor(node)) {
+ !node || !node_has_preferred_descriptor(node, 0)) {
SMARTLIST_DEL_CURRENT(responsible_dirs, dir);
continue;
}