[tor-commits] [tor/maint-0.2.2] Refactor HS client state-clearing code into a separate function

nickm at torproject.org nickm at torproject.org
Thu Jun 2 19:06:16 UTC 2011


commit d7af8a2f076a38d8be32798d34049ce150c8dda0
Author: Robert Ransom <rransom.8774 at gmail.com>
Date:   Thu Jun 2 02:57:29 2011 -0700

    Refactor HS client state-clearing code into a separate function
---
 src/or/main.c       |    4 +---
 src/or/rendclient.c |   10 ++++++++++
 src/or/rendclient.h |    2 ++
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/or/main.c b/src/or/main.c
index 3c84dda..bc639db 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -853,9 +853,7 @@ signewnym_impl(time_t now)
 
   circuit_expire_all_dirty_circs();
   addressmap_clear_transient();
-  rend_cache_purge();
-  rend_client_cancel_descriptor_fetches();
-  rend_client_purge_last_hid_serv_requests();
+  rend_client_purge_state();
   time_of_last_signewnym = now;
   signewnym_is_pending = 0;
 }
diff --git a/src/or/rendclient.c b/src/or/rendclient.c
index 12b54df..329b256 100644
--- a/src/or/rendclient.c
+++ b/src/or/rendclient.c
@@ -27,6 +27,16 @@ static extend_info_t *rend_client_get_random_intro_impl(
                           const rend_cache_entry_t *rend_query,
                           const int strict, const int warnings);
 
+/** Purge all potentially remotely-detectable state held in the hidden
+ * service client code.  Called on SIGNAL NEWNYM. */
+void
+rend_client_purge_state(void)
+{
+  rend_cache_purge();
+  rend_client_cancel_descriptor_fetches();
+  rend_client_purge_last_hid_serv_requests();
+}
+
 /** Called when we've established a circuit to an introduction point:
  * send the introduction request. */
 void
diff --git a/src/or/rendclient.h b/src/or/rendclient.h
index 2bfc850..c6cf82b 100644
--- a/src/or/rendclient.h
+++ b/src/or/rendclient.h
@@ -12,6 +12,8 @@
 #ifndef _TOR_RENDCLIENT_H
 #define _TOR_RENDCLIENT_H
 
+void rend_client_purge_state(void);
+
 void rend_client_introcirc_has_opened(origin_circuit_t *circ);
 void rend_client_rendcirc_has_opened(origin_circuit_t *circ);
 int rend_client_introduction_acked(origin_circuit_t *circ,





More information about the tor-commits mailing list