aboutsummaryrefslogtreecommitdiff
path: root/src/feature/hs/hs_pow.c
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2022-06-28 13:43:35 -0400
committerMicah Elizabeth Scott <beth@torproject.org>2023-05-10 07:37:11 -0700
commitca74530b40aa893196de2f6cdde9bcaeec4d03c2 (patch)
tree74a38ee01bf119ec64d172b42a9bb87ba1a89d88 /src/feature/hs/hs_pow.c
parent8b41e09a775e882096364210317813c830160a5b (diff)
downloadtor-ca74530b40aa893196de2f6cdde9bcaeec4d03c2.tar.gz
tor-ca74530b40aa893196de2f6cdde9bcaeec4d03c2.zip
hs: Setup service side PoW defenses
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/feature/hs/hs_pow.c')
-rw-r--r--src/feature/hs/hs_pow.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/feature/hs/hs_pow.c b/src/feature/hs/hs_pow.c
index 2b36da93db..c24ea5e351 100644
--- a/src/feature/hs/hs_pow.c
+++ b/src/feature/hs/hs_pow.c
@@ -278,3 +278,15 @@ hs_pow_remove_seed_from_cache(uint32_t seed)
HT_FOREACH_FN(nonce_cache_table_ht, &nonce_cache_table,
nonce_cache_entry_has_seed, &seed);
}
+
+/** Free a given PoW service state. */
+void
+hs_pow_free_service_state(hs_pow_service_state_t *state)
+{
+ if (state == NULL) {
+ return;
+ }
+ smartlist_free(state->rend_request_pqueue);
+ mainloop_event_free(state->pop_pqueue_ev);
+ tor_free(state);
+}