diff options
author | David Goulet <dgoulet@torproject.org> | 2017-09-05 15:52:05 -0400 |
---|---|---|
committer | George Kadianakis <desnacked@riseup.net> | 2017-09-08 19:07:00 +0300 |
commit | cd07af60c9e73e16034870ee1d03f729c1f2dd98 (patch) | |
tree | e47840ac1eeb0995f2b0adcd4cc6db75580bb709 /src/or/hs_common.c | |
parent | b586de78e37425c3f4b79fb0da32971ed5216401 (diff) | |
download | tor-cd07af60c9e73e16034870ee1d03f729c1f2dd98.tar.gz tor-cd07af60c9e73e16034870ee1d03f729c1f2dd98.zip |
prop224: Expand the overlap period concept to be a full SRV protocol run
Because of #23387, we've realized that there is one scenario that makes
the client unable to reach the service because of a desynch in the time
period used. The scenario is as follows:
+------------------------------------------------------------------+
| |
| 00:00 12:00 00:00 12:00 00:00 12:00 |
| SRV#1 TP#1 SRV#2 TP#2 SRV#3 TP#3 |
| |
| $==========|-----------$===========|-----------$===========| |
| ^ ^ |
| C S |
+------------------------------------------------------------------+
In this scenario the HS has a newer consensus than the client, and the
HS just moved to the next TP but the client is still stuck on the old
one. However, the service is not in any sort of overlap mode so it
doesn't cover the old TP anymore, so the client is unable to fetch a
descriptor.
We've decided to solve this by extending the concept of overlap period
to be permanent so that the service always publishes two descriptors and
aims to cover clients with both older and newer consensuses. See the
spec patch in #23387 for more details.
Diffstat (limited to 'src/or/hs_common.c')
-rw-r--r-- | src/or/hs_common.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/or/hs_common.c b/src/or/hs_common.c index 75339df6cd..3bf423f855 100644 --- a/src/or/hs_common.c +++ b/src/or/hs_common.c @@ -276,6 +276,14 @@ hs_get_next_time_period_num(time_t now) return hs_get_time_period_num(now) + 1; } +/* Get the number of the _previous_ HS time period, given that the current + * time is <b>now</b>. */ +uint64_t +hs_get_previous_time_period_num(time_t now) +{ + return hs_get_time_period_num(now) - 1; +} + /* Return the start time of the upcoming time period based on <b>now</b>. */ time_t hs_get_start_time_of_next_time_period(time_t now) |