aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_hs_common.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/test/test_hs_common.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/test/test_hs_common.c')
-rw-r--r--src/test/test_hs_common.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/test/test_hs_common.c b/src/test/test_hs_common.c
index 6bb03f39d6..9980892951 100644
--- a/src/test/test_hs_common.c
+++ b/src/test/test_hs_common.c
@@ -613,10 +613,10 @@ test_desc_reupload_logic(void *arg)
tt_int_op(service_desc_hsdirs_changed(service, desc), OP_EQ, 1);
tt_int_op(smartlist_len(desc->previous_hsdirs), OP_EQ, 6);
- /* Now order another upload and see how we end up with 7 hsdirs */
+ /* Now order another upload and see that we keep having 6 prev hsdirs */
upload_descriptor_to_all(service, desc, 0);
/* Check that previous hsdirs were populated */
- tt_int_op(smartlist_len(desc->previous_hsdirs), OP_EQ, 7);
+ tt_int_op(smartlist_len(desc->previous_hsdirs), OP_EQ, 6);
/* Now restore the HSDir hash ring to its original state by swapping back
aaron for nora */