diff options
author | David Goulet <dgoulet@torproject.org> | 2017-09-01 16:18:50 -0400 |
---|---|---|
committer | George Kadianakis <desnacked@riseup.net> | 2017-09-07 18:16:07 +0300 |
commit | 72c7f81459e087e2a0485361eb34db1023d12155 (patch) | |
tree | d8f01ee1d12860ac5cff8f90fcaa93df7359265f /src/or/nodelist.c | |
parent | f117da3ea006fbdda3f5e921d5f8da2ae3d3bdfd (diff) | |
download | tor-72c7f81459e087e2a0485361eb34db1023d12155.tar.gz tor-72c7f81459e087e2a0485361eb34db1023d12155.zip |
prop224: When computing hsdir index and time period, use valid_after time
Use the valid_after time from the consensus to get the time period number else
we might get out of sync with the overlap period that uses valid_after.
Make it an optional feature since some functions require passing a
specific time (like hs_get_start_time_of_next_time_period()).
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/nodelist.c')
-rw-r--r-- | src/or/nodelist.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/or/nodelist.c b/src/or/nodelist.c index 03b315e682..80f3b2b0ae 100644 --- a/src/or/nodelist.c +++ b/src/or/nodelist.c @@ -200,9 +200,11 @@ node_set_hsdir_index(node_t *node, const networkstatus_t *ns) goto done; } - /* Get the current and next time period number, we might use them both. */ - current_time_period_num = hs_get_time_period_num(now); - next_time_period_num = hs_get_next_time_period_num(now); + /* Get the current and next time period number, we might use them both. We + * use the valid_after time of the consensus because we use that time to + * detect if we are in the overlap period or not. */ + current_time_period_num = hs_get_time_period_num(0); + next_time_period_num = hs_get_next_time_period_num(0); if (hs_overlap_mode_is_active(ns, now)) { /* We are in overlap mode, this means that our consensus has just cycled |