mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 05:33:47 +01:00
Make room for v3: Rename rephist objects to signify they are v2-only.
This commit is contained in:
parent
7a75a1064f
commit
62d682e624
@ -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++;
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user