summaryrefslogtreecommitdiff
path: root/src/or/hs_service.c
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2017-08-29 16:02:01 +0300
committerGeorge Kadianakis <desnacked@riseup.net>2017-08-30 15:42:25 +0300
commitb9f849bdee20f36264fe061498536e0d3a8616a6 (patch)
tree8c77d78cb14f50cda853afd4dcab6a10361fb2e9 /src/or/hs_service.c
parent1dc21b87904b527140446674876076f29c78b89f (diff)
downloadtor-b9f849bdee20f36264fe061498536e0d3a8616a6.tar.gz
tor-b9f849bdee20f36264fe061498536e0d3a8616a6.zip
prop224: Clear list of prev hsdirs before we upload all descs.
This fixes a serious bug in our hsdir set change logic: We used to add nodes in the list of previous hsdirs everytime we uploaded to a new hsdir and we only cleared the list when we built a new descriptor. This means that our prev_hsdirs list could end up with 7 hsdirs, if for some reason we ended up uploading our desc to 7 hsdirs before rebuilding our descriptor (e.g. this can happen if the set of hsdirs changed). After our previous hdsir set had 7 nodes, then our old algorithm would always think that the set has changed since it was comparing a smartlist with 7 elements against a smartlist with 6 elements. This commit fixes this bug, by clearning the prev_hsdirs list before we upload to all hsdirs. This makes sure that our prev_hsdirs list always contains the latest hsdirs!
Diffstat (limited to 'src/or/hs_service.c')
-rw-r--r--src/or/hs_service.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/or/hs_service.c b/src/or/hs_service.c
index 0fba0d7f90..218d49ace3 100644
--- a/src/or/hs_service.c
+++ b/src/or/hs_service.c
@@ -2316,6 +2316,10 @@ upload_descriptor_to_all(const hs_service_t *service,
hs_get_responsible_hsdirs(&desc->blinded_kp.pubkey, desc->time_period_num,
for_next_period, 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. */
+ service_desc_clear_previous_hsdirs(desc);
+
/* For each responsible HSDir we have, initiate an upload command. */
SMARTLIST_FOREACH_BEGIN(responsible_dirs, const routerstatus_t *,
hsdir_rs) {