]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
prop224: 'is_new_tp' -> 'use_second_hdsir_index' in hs_get_responsible_hsdirs()
authorGeorge Kadianakis <desnacked@riseup.net>
Fri, 8 Sep 2017 09:51:30 +0000 (12:51 +0300)
committerGeorge Kadianakis <desnacked@riseup.net>
Fri, 8 Sep 2017 16:07:00 +0000 (19:07 +0300)
src/or/hs_common.c
src/or/hs_common.h

index ee08aff7b3c7cf17d86f79f00bc4ca50ebce37d5..e5ea379540539954bab1ac6ec59ac3ebaa61e5c5 100644 (file)
@@ -1277,18 +1277,18 @@ node_has_hsdir_index(const node_t *node)
 
 /* For a given blinded key and time period number, get the responsible HSDir
  * and put their routerstatus_t object in the responsible_dirs list. If
- * is_next_period is true, the next hsdir_index of the node_t is used. If
- * 'for_fetching' is true, the spread fetch consensus parameter is used else
- * the spread store is used which is only for upload. This function can't fail
- * but it is possible that the responsible_dirs list contains fewer nodes than
- * expected.
+ * 'use_second_hsdir_index' is true, use the second hsdir_index of the node_t
+ * is used. If 'for_fetching' is true, the spread fetch consensus parameter is
+ * used else the spread store is used which is only for upload. This function
+ * can't fail but it is possible that the responsible_dirs list contains fewer
+ * nodes than expected.
  *
  * This function goes over the latest consensus routerstatus list and sorts it
  * by their node_t hsdir_index then does a binary search to find the closest
  * node. All of this makes it a bit CPU intensive so use it wisely. */
 void
 hs_get_responsible_hsdirs(const ed25519_public_key_t *blinded_pk,
-                          uint64_t time_period_num, int is_new_tp,
+                          uint64_t time_period_num, int use_second_hsdir_index,
                           int for_fetching, smartlist_t *responsible_dirs)
 {
   smartlist_t *sorted_nodes;
@@ -1336,7 +1336,7 @@ hs_get_responsible_hsdirs(const ed25519_public_key_t *blinded_pk,
   if (for_fetching) {
     smartlist_sort(sorted_nodes, compare_node_fetch_hsdir_index);
     cmp_fct = compare_digest_to_fetch_hsdir_index;
-  } else if (is_new_tp) {
+  } else if (use_second_hsdir_index) {
     smartlist_sort(sorted_nodes, compare_node_store_second_hsdir_index);
     cmp_fct = compare_digest_to_store_second_hsdir_index;
   } else {
index 2229ae48ad79439b7d76f0bd346df4497bc6038f..b2e3c836d21f28cba1197c67b0c00d6c9e659edd 100644 (file)
@@ -224,7 +224,8 @@ int32_t hs_get_hsdir_spread_fetch(void);
 int32_t hs_get_hsdir_spread_store(void);
 
 void hs_get_responsible_hsdirs(const ed25519_public_key_t *blinded_pk,
-                              uint64_t time_period_num, int is_next_period,
+                              uint64_t time_period_num,
+                              int use_second_hsdir_index,
                               int for_fetching, smartlist_t *responsible_dirs);
 routerstatus_t *hs_pick_hsdir(smartlist_t *responsible_dirs,
                               const char *req_key_str);