[tor-commits] [tor/master] Purge client HS failure cache on NEWNYM

nickm at torproject.org nickm at torproject.org
Tue Aug 11 13:36:11 UTC 2015


commit d06af95ba3fdcb0c9820dcf34146ba68458d5e46
Author: David Goulet <dgoulet at ev0ke.net>
Date:   Thu Jun 25 15:11:40 2015 -0400

    Purge client HS failure cache on NEWNYM
    
    Signed-off-by: David Goulet <dgoulet at ev0ke.net>
---
 src/or/rendcache.c  |   12 ++++++++++++
 src/or/rendcache.h  |    1 +
 src/or/rendclient.c |    1 +
 3 files changed, 14 insertions(+)

diff --git a/src/or/rendcache.c b/src/or/rendcache.c
index 7a86546..acb9447 100644
--- a/src/or/rendcache.c
+++ b/src/or/rendcache.c
@@ -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
diff --git a/src/or/rendcache.h b/src/or/rendcache.h
index 21be9f9..9a18810 100644
--- a/src/or/rendcache.h
+++ b/src/or/rendcache.h
@@ -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 */
 
diff --git a/src/or/rendclient.c b/src/or/rendclient.c
index 0b22f46..c6f29a7 100644
--- a/src/or/rendclient.c
+++ b/src/or/rendclient.c
@@ -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();
 }





More information about the tor-commits mailing list