[or-cvs] r16847: {tor} When shutting down Tor, free the history of client requests (tor/branches/hidserv-design-changes/src/or)

kloesing at seul.org kloesing at seul.org
Thu Sep 11 16:15:39 UTC 2008


Author: kloesing
Date: 2008-09-11 12:15:39 -0400 (Thu, 11 Sep 2008)
New Revision: 16847

Modified:
   tor/branches/hidserv-design-changes/src/or/main.c
   tor/branches/hidserv-design-changes/src/or/or.h
   tor/branches/hidserv-design-changes/src/or/rendclient.c
Log:
When shutting down Tor, free the history of client requests to hidden services, too.

Modified: tor/branches/hidserv-design-changes/src/or/main.c
===================================================================
--- tor/branches/hidserv-design-changes/src/or/main.c	2008-09-11 14:35:04 UTC (rev 16846)
+++ tor/branches/hidserv-design-changes/src/or/main.c	2008-09-11 16:15:39 UTC (rev 16847)
@@ -1934,6 +1934,7 @@
   rend_service_free_all();
   rend_cache_free_all();
   rend_service_authorization_free_all();
+  rend_client_request_history_free_all();
   rep_hist_free_all();
   hs_usage_free_all();
   dns_free_all();

Modified: tor/branches/hidserv-design-changes/src/or/or.h
===================================================================
--- tor/branches/hidserv-design-changes/src/or/or.h	2008-09-11 14:35:04 UTC (rev 16846)
+++ tor/branches/hidserv-design-changes/src/or/or.h	2008-09-11 16:15:39 UTC (rev 16847)
@@ -3866,6 +3866,8 @@
                                                 const char *onion_address);
 void rend_service_authorization_free_all(void);
 
+void rend_client_request_history_free_all(void);
+
 /********************************* rendcommon.c ***************************/
 
 /** Hidden-service side configuration of client authorization. */

Modified: tor/branches/hidserv-design-changes/src/or/rendclient.c
===================================================================
--- tor/branches/hidserv-design-changes/src/or/rendclient.c	2008-09-11 14:35:04 UTC (rev 16846)
+++ tor/branches/hidserv-design-changes/src/or/rendclient.c	2008-09-11 16:15:39 UTC (rev 16847)
@@ -277,6 +277,26 @@
  * values are pointers to timestamps of the last requests. */
 static strmap_t *last_hid_serv_requests = NULL;
 
+/** Helper for strmap_free. */
+static void
+last_hid_serv_requests_strmap_item_free(void *request)
+{
+  tor_free(request);
+}
+
+/** Release all the storage held in last_hid_serv_requests.
+ */
+void
+rend_client_request_history_free_all(void)
+{
+  if (!last_hid_serv_requests) {
+    return;
+  }
+  strmap_free(last_hid_serv_requests,
+              last_hid_serv_requests_strmap_item_free);
+  last_hid_serv_requests = NULL;
+}
+
 /** Look up the last request time to hidden service directory <b>hs_dir</b>
  * for descriptor ID <b>desc_id_base32</b>. If <b>set</b> is non-zero,
  * assign the current time <b>now</b> and return that. Otherwise, return



More information about the tor-commits mailing list