summaryrefslogtreecommitdiff
path: root/src/or/hs_common.h
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2017-08-04 12:21:14 +0300
committerNick Mathewson <nickm@torproject.org>2017-08-08 20:29:34 -0400
commitb89d2fa1db2379bffd2e2b4c851c3facc57b6ed8 (patch)
tree6f4769adc1ddfd5d4c82958eba03ce5575bd113c /src/or/hs_common.h
parent440eaa9b22573cdb0d38bf5c13200cc1077a453f (diff)
downloadtor-b89d2fa1db2379bffd2e2b4c851c3facc57b6ed8.tar.gz
tor-b89d2fa1db2379bffd2e2b4c851c3facc57b6ed8.zip
Don't set HSDir index if we don't have a live consensus.
We also had to alter the SRV functions to take a consensus as optional input, since we might be setting our HSDir index using a consensus that is currently being processed and won't be returned by the networkstatus_get_live_consensus() function. This change has two results: a) It makes sure we are using a fresh consensus with the right SRV value when we are calculating the HSDir hash ring. b) It ensures that we will not use the sr_get_current/previous() functions when we don't have a consensus which would have falsely triggered the disaster SRV logic.
Diffstat (limited to 'src/or/hs_common.h')
-rw-r--r--src/or/hs_common.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/or/hs_common.h b/src/or/hs_common.h
index 268a69bb52..7e37f81e5c 100644
--- a/src/or/hs_common.h
+++ b/src/or/hs_common.h
@@ -200,8 +200,10 @@ link_specifier_t *hs_link_specifier_dup(const link_specifier_t *lspec);
MOCK_DECL(int, hs_overlap_mode_is_active,
(const networkstatus_t *consensus, time_t now));
-uint8_t *hs_get_current_srv(uint64_t time_period_num);
-uint8_t *hs_get_previous_srv(uint64_t time_period_num);
+uint8_t *hs_get_current_srv(uint64_t time_period_num,
+ const networkstatus_t *ns);
+uint8_t *hs_get_previous_srv(uint64_t time_period_num,
+ const networkstatus_t *ns);
void hs_build_hsdir_index(const ed25519_public_key_t *identity_pk,
const uint8_t *srv, uint64_t period_num,