diff options
author | David Goulet <dgoulet@torproject.org> | 2017-09-06 11:12:28 -0400 |
---|---|---|
committer | George Kadianakis <desnacked@riseup.net> | 2017-09-08 19:07:00 +0300 |
commit | 4d38731e93e927374044fde2730149cb07ac0766 (patch) | |
tree | 2b29a13ddf60b76774a0f0b176e6fc1066747f71 /src/or/hs_service.c | |
parent | cd07af60c9e73e16034870ee1d03f729c1f2dd98 (diff) | |
download | tor-4d38731e93e927374044fde2730149cb07ac0766.tar.gz tor-4d38731e93e927374044fde2730149cb07ac0766.zip |
prop224: Make client and service pick same HSDir
With the latest change on how we use the HSDir index, the client and service
need to pick their responsible HSDir differently that is depending on if they
are before or after a new time period.
The overlap mode is active function has been renamed for this and test added.
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/hs_service.c')
-rw-r--r-- | src/or/hs_service.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/or/hs_service.c b/src/or/hs_service.c index 8cdf95d193..41154d270e 100644 --- a/src/or/hs_service.c +++ b/src/or/hs_service.c @@ -2380,19 +2380,23 @@ set_descriptor_revision_counter(hs_descriptor_t *hs_desc) * if PublishHidServDescriptors is false. */ STATIC void upload_descriptor_to_all(const hs_service_t *service, - hs_service_descriptor_t *desc, int for_next_period) + hs_service_descriptor_t *desc) { + unsigned int is_new_tp = 0; smartlist_t *responsible_dirs = NULL; tor_assert(service); tor_assert(desc); + /* Do we have a new TP that is are we between a new time period and the next + * SRV creation? */ + is_new_tp = hs_time_between_tp_and_srv(NULL, approx_time()); /* Get our list of responsible HSDir. */ responsible_dirs = smartlist_new(); /* The parameter 0 means that we aren't a client so tell the function to use * the spread store consensus paremeter. */ hs_get_responsible_hsdirs(&desc->blinded_kp.pubkey, desc->time_period_num, - for_next_period, 0, responsible_dirs); + is_new_tp, 0, responsible_dirs); /** Clear list of previous hsdirs since we are about to upload to a new * list. Let's keep it up to date. */ @@ -2539,8 +2543,6 @@ run_upload_descriptor_event(time_t now) /* Run v3+ check. */ FOR_EACH_SERVICE_BEGIN(service) { FOR_EACH_DESCRIPTOR_BEGIN(service, desc) { - int for_next_period = 0; - /* If we were asked to re-examine the hash ring, and it changed, then schedule an upload */ if (consider_republishing_hs_descriptors && @@ -2566,12 +2568,7 @@ run_upload_descriptor_event(time_t now) * accurate because all circuits have been established. */ build_desc_intro_points(service, desc, now); - /* The next descriptor needs the next time period for computing the - * corresponding hashring. */ - if (desc == service->desc_next) { - for_next_period = 1; - } - upload_descriptor_to_all(service, desc, for_next_period); + upload_descriptor_to_all(service, desc); } FOR_EACH_DESCRIPTOR_END; } FOR_EACH_SERVICE_END; |