]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Purge client HS failure cache on NEWNYM
authorDavid Goulet <dgoulet@ev0ke.net>
Thu, 25 Jun 2015 19:11:40 +0000 (15:11 -0400)
committerNick Mathewson <nickm@torproject.org>
Tue, 11 Aug 2015 13:34:41 +0000 (09:34 -0400)
Signed-off-by: David Goulet <dgoulet@ev0ke.net>
src/or/rendcache.c
src/or/rendcache.h
src/or/rendclient.c

index 7a86546b7ab3fe82f0f988005e910eb1cdc04d8d..acb9447de8acfc21d322e4b6025aa71ae8f964cb 100644 (file)
@@ -258,6 +258,18 @@ rend_cache_purge(void)
   rend_cache = strmap_new();
 }
 
+/** Remove ALL entries from the failure cache. This is also called when a
+ * NEWNYM signal is received. */
+void
+rend_cache_failure_purge(void)
+{
+  if (rend_cache_failure) {
+    log_info(LD_REND, "Purging HS failure cache");
+    strmap_free(rend_cache_failure, rend_cache_failure_entry_free_);
+  }
+  rend_cache_failure = strmap_new();
+}
+
 /** Lookup the rend failure cache using a relay identity digest in
  * <b>identity</b> and service ID <b>service_id</b>. If found, the intro
  * failure is set in <b>intro_entry</b> else it stays untouched. Return 1
index 21be9f908bfc3c25eda77a00d7103d7021673fd0..9a18810821a21068b68dba18d554dc6c5e44b10b 100644 (file)
@@ -68,6 +68,7 @@ size_t rend_cache_get_total_allocation(void);
 void rend_cache_intro_failure_note(unsigned int failure,
                                    const uint8_t *identity,
                                    const char *service_id);
+void rend_cache_failure_purge(void);
 
 #endif /* TOR_RENDCACHE_H */
 
index 0b22f46ac08c5ab1835b037a7ea199121c175092..c6f29a7707e54608d8b8e4195500c9b9e8f902d5 100644 (file)
@@ -38,6 +38,7 @@ void
 rend_client_purge_state(void)
 {
   rend_cache_purge();
+  rend_cache_failure_purge();
   rend_client_cancel_descriptor_fetches();
   rend_client_purge_last_hid_serv_requests();
 }