[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] free helper node status info on shutdown



Update of /home/or/cvsroot/tor/src/or
In directory moria:/tmp/cvs-serv8301/src/or

Modified Files:
	circuitbuild.c main.c or.h 
Log Message:
free helper node status info on shutdown

Index: circuitbuild.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/circuitbuild.c,v
retrieving revision 1.145
retrieving revision 1.146
diff -u -d -r1.145 -r1.146
--- circuitbuild.c	29 Sep 2005 22:59:17 -0000	1.145
+++ circuitbuild.c	30 Sep 2005 21:38:57 -0000	1.146
@@ -1672,6 +1672,16 @@
   helper_nodes_changed();
 }
 
+/** Release all storage held by the list of helper nodes */
+void
+helper_nodes_free_all(void)
+{
+  /* Don't call clear_helper_nodes(); that will flush our state change to disk */
+  SMARTLIST_FOREACH(helper_nodes, helper_node_t *, h, tor_free(h));
+  smartlist_free(helper_nodes);
+  helper_nodes = NULL;
+}
+
 /** How long (in seconds) do we allow a helper node to be nonfunctional before
  * we give up on it? */
 #define HELPER_ALLOW_DOWNTIME 48*60*60
@@ -1899,6 +1909,7 @@
   if (*err || !set) {
     SMARTLIST_FOREACH(helpers, helper_node_t *, h, tor_free(h));
     smartlist_free(helpers);
+    helpers = NULL;
   }
   if (!*err && set) {
     if (helper_nodes) {

Index: main.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/main.c,v
retrieving revision 1.563
retrieving revision 1.564
diff -u -d -r1.563 -r1.564
--- main.c	30 Sep 2005 21:22:25 -0000	1.563
+++ main.c	30 Sep 2005 21:38:57 -0000	1.564
@@ -1361,6 +1361,7 @@
   dns_free_all();
   clear_pending_onions();
   circuit_free_all();
+  helper_nodes_free_all();
   connection_free_all();
   if (!postfork) {
     config_free_all();

Index: or.h
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/or.h,v
retrieving revision 1.699
retrieving revision 1.700
diff -u -d -r1.699 -r1.700
--- or.h	30 Sep 2005 20:04:55 -0000	1.699
+++ or.h	30 Sep 2005 21:38:57 -0000	1.700
@@ -1396,6 +1396,7 @@
 int helper_nodes_update_state(or_state_t *state);
 int helper_nodes_parse_state(or_state_t *state, int set, const char **err);
 int helper_nodes_getinfo_helper(const char *question, char **answer);
+void helper_nodes_free_all(void);
 
 /********************************* circuitlist.c ***********************/