]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Persist n_downloaded counter for lifetime of HS key.
authorMike Perry <mikeperry-git@torproject.org>
Tue, 3 Jun 2025 19:57:07 +0000 (19:57 +0000)
committerMike Perry <mikeperry-git@torproject.org>
Thu, 5 Jun 2025 15:13:01 +0000 (15:13 +0000)
src/feature/hs/hs_cache.c

index 66aab2a5060016d874562d53276869f6bf80537f..bd8f888bb030699695cdfabd33c5112ecaa54369 100644 (file)
@@ -191,8 +191,10 @@ cache_store_v3_as_dir(hs_cache_dir_descriptor_t *desc)
       goto err;
     }
     /* We now know that the descriptor we just received is a new one so
+     * preserve the downloaded counter from the old entry and then
      * remove the entry we currently have from our cache so we can then
      * store the new one. */
+    desc->n_downloaded = cache_entry->n_downloaded;
     remove_v3_desc_as_dir(cache_entry);
     hs_cache_decrement_allocation(cache_get_dir_entry_size(cache_entry));
     cache_dir_desc_free(cache_entry);