[tor-commits] [tor/master] Make room for v3: Rename rephist objects to signify they are v2-only.

dgoulet at torproject.org dgoulet at torproject.org
Tue Nov 17 15:49:48 UTC 2020


commit 62d682e62422eecd40f2e2ba4d222bb2795dad53
Author: George Kadianakis <desnacked at riseup.net>
Date:   Wed Jul 1 13:29:33 2020 +0300

    Make room for v3: Rename rephist objects to signify they are v2-only.
---
 src/feature/rend/rendcache.c |  2 +-
 src/feature/stats/rephist.c  | 18 +++++++++---------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/feature/rend/rendcache.c b/src/feature/rend/rendcache.c
index 53fec7532f..715e70eba7 100644
--- a/src/feature/rend/rendcache.c
+++ b/src/feature/rend/rendcache.c
@@ -718,7 +718,7 @@ rend_cache_store_v2_desc_as_dir(const char *desc)
              safe_str(desc_id_base32), (int)encoded_size);
     /* Statistics: Note down this potentially new HS. */
     if (options->HiddenServiceStatistics) {
-      rep_hist_stored_maybe_new_hs(e->parsed->pk);
+      rep_hist_hsdir_stored_maybe_new_v2_onion(e->parsed->pk);
     }
 
     number_stored++;
diff --git a/src/feature/stats/rephist.c b/src/feature/stats/rephist.c
index b6730e1226..b66eed80ef 100644
--- a/src/feature/stats/rephist.c
+++ b/src/feature/stats/rephist.c
@@ -1720,7 +1720,7 @@ typedef struct hs_stats_t {
 
   /** Set of unique public key digests we've seen this stat period
    * (could also be implemented as sorted smartlist). */
-  digestmap_t *onions_seen_this_period;
+  digestmap_t *v2_onions_seen_this_period;
 } hs_stats_t;
 
 /** Our statistics structure singleton. */
@@ -1731,7 +1731,7 @@ static hs_stats_t *
 hs_stats_new(void)
 {
   hs_stats_t *new_hs_stats = tor_malloc_zero(sizeof(hs_stats_t));
-  new_hs_stats->onions_seen_this_period = digestmap_new();
+  new_hs_stats->v2_onions_seen_this_period = digestmap_new();
 
   return new_hs_stats;
 }
@@ -1747,7 +1747,7 @@ hs_stats_free_(hs_stats_t *victim_hs_stats)
     return;
   }
 
-  digestmap_free(victim_hs_stats->onions_seen_this_period, NULL);
+  digestmap_free(victim_hs_stats->v2_onions_seen_this_period, NULL);
   tor_free(victim_hs_stats);
 }
 
@@ -1773,8 +1773,8 @@ rep_hist_reset_hs_stats(time_t now)
 
   hs_stats->rp_relay_cells_seen = 0;
 
-  digestmap_free(hs_stats->onions_seen_this_period, NULL);
-  hs_stats->onions_seen_this_period = digestmap_new();
+  digestmap_free(hs_stats->v2_onions_seen_this_period, NULL);
+  hs_stats->v2_onions_seen_this_period = digestmap_new();
 
   start_of_hs_stats_interval = now;
 }
@@ -1802,7 +1802,7 @@ rep_hist_seen_new_rp_cell(void)
  *  <b>pubkey</b>. Check whether we have counted it before, if not
  *  count it now! */
 void
-rep_hist_stored_maybe_new_hs(const crypto_pk_t *pubkey)
+rep_hist_hsdir_stored_maybe_new_v2_onion(const crypto_pk_t *pubkey)
 {
   char pubkey_hash[DIGEST_LEN];
 
@@ -1820,9 +1820,9 @@ rep_hist_stored_maybe_new_hs(const crypto_pk_t *pubkey)
 
   /* Check if this is the first time we've seen this hidden
      service. If it is, count it as new. */
-  if (!digestmap_get(hs_stats->onions_seen_this_period,
+  if (!digestmap_get(hs_stats->v2_onions_seen_this_period,
                      pubkey_hash)) {
-    digestmap_set(hs_stats->onions_seen_this_period,
+    digestmap_set(hs_stats->v2_onions_seen_this_period,
                   pubkey_hash, (void*)(uintptr_t)1);
   }
 }
@@ -1870,7 +1870,7 @@ rep_hist_format_hs_stats(time_t now)
 
   uint64_t rounded_onions_seen =
     round_uint64_to_next_multiple_of((size_t)digestmap_size(
-                                        hs_stats->onions_seen_this_period),
+                                        hs_stats->v2_onions_seen_this_period),
                                      ONIONS_SEEN_BIN_SIZE);
   rounded_onions_seen = MIN(rounded_onions_seen, INT64_MAX);
   obfuscated_onions_seen = add_laplace_noise((int64_t)rounded_onions_seen,





More information about the tor-commits mailing list