[tor-commits] [tor/master] prop224: 'is_new_tp' -> 'use_second_hdsir_index' in hs_get_responsible_hsdirs()

nickm at torproject.org nickm at torproject.org
Fri Sep 8 16:12:37 UTC 2017


commit eb81a8e69c654abc0830ce76899945235cf09d7d
Author: George Kadianakis <desnacked at riseup.net>
Date:   Fri Sep 8 12:51:30 2017 +0300

    prop224: 'is_new_tp' -> 'use_second_hdsir_index' in hs_get_responsible_hsdirs()
---
 src/or/hs_common.c | 14 +++++++-------
 src/or/hs_common.h |  3 ++-
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/or/hs_common.c b/src/or/hs_common.c
index ee08aff7b..e5ea37954 100644
--- a/src/or/hs_common.c
+++ b/src/or/hs_common.c
@@ -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 {
diff --git a/src/or/hs_common.h b/src/or/hs_common.h
index 2229ae48a..b2e3c836d 100644
--- a/src/or/hs_common.h
+++ b/src/or/hs_common.h
@@ -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);





More information about the tor-commits mailing list