summaryrefslogtreecommitdiff
path: root/src/or/hs_common.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-06-20 08:05:07 -0400
committerNick Mathewson <nickm@torproject.org>2018-06-20 08:05:07 -0400
commit11a76b903b283ee39ab0dbf9d926d4c4b60b7a92 (patch)
tree94e6e66939beb2560b0901762bfd8c37f0e738cb /src/or/hs_common.c
parent334edc22d1bd05cbadb1ccc132d099e8a282bff4 (diff)
parent7b9cd5cca54d0077c0f8c163a58b055c85bf067f (diff)
downloadtor-11a76b903b283ee39ab0dbf9d926d4c4b60b7a92.tar.gz
tor-11a76b903b283ee39ab0dbf9d926d4c4b60b7a92.zip
Merge branch 'maint-0.3.4'
Diffstat (limited to 'src/or/hs_common.c')
-rw-r--r--src/or/hs_common.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/or/hs_common.c b/src/or/hs_common.c
index c63d4330d6..4ee06dd9b6 100644
--- a/src/or/hs_common.c
+++ b/src/or/hs_common.c
@@ -1338,15 +1338,20 @@ hs_get_responsible_hsdirs(const ed25519_public_key_t *blinded_pk,
sorted_nodes = smartlist_new();
+ /* Make sure we actually have a live consensus */
+ networkstatus_t *c = networkstatus_get_live_consensus(approx_time());
+ if (!c || smartlist_len(c->routerstatus_list) == 0) {
+ log_warn(LD_REND, "No live consensus so we can't get the responsible "
+ "hidden service directories.");
+ goto done;
+ }
+
+ /* Ensure the nodelist is fresh, since it contains the HSDir indices. */
+ nodelist_ensure_freshness(c);
+
/* Add every node_t that support HSDir v3 for which we do have a valid
* hsdir_index already computed for them for this consensus. */
{
- networkstatus_t *c = networkstatus_get_latest_consensus();
- if (!c || smartlist_len(c->routerstatus_list) == 0) {
- log_warn(LD_REND, "No valid consensus so we can't get the responsible "
- "hidden service directories.");
- goto done;
- }
SMARTLIST_FOREACH_BEGIN(c->routerstatus_list, const routerstatus_t *, rs) {
/* Even though this node_t object won't be modified and should be const,
* we can't add const object in a smartlist_t. */