aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2005-09-30 21:38:57 +0000
committerNick Mathewson <nickm@torproject.org>2005-09-30 21:38:57 +0000
commit9e54e2e2931a4c86ff13b70a8a04024f83cd67a2 (patch)
treeb5d383f37f23e2b25c540f9929e85c1ed8084932 /src
parent808e584a875e12ee084b49636283a1a24fce5f91 (diff)
downloadtor-9e54e2e2931a4c86ff13b70a8a04024f83cd67a2.tar
tor-9e54e2e2931a4c86ff13b70a8a04024f83cd67a2.tar.gz
free helper node status info on shutdown
svn:r5177
Diffstat (limited to 'src')
-rw-r--r--src/or/circuitbuild.c11
-rw-r--r--src/or/main.c1
-rw-r--r--src/or/or.h1
3 files changed, 13 insertions, 0 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index d488fbe12..57a2d86f8 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -1672,6 +1672,16 @@ clear_helper_nodes(void)
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 @@ helper_nodes_parse_state(or_state_t *state, int set, const char **err)
if (*err || !set) {
SMARTLIST_FOREACH(helpers, helper_node_t *, h, tor_free(h));
smartlist_free(helpers);
+ helpers = NULL;
}
if (!*err && set) {
if (helper_nodes) {
diff --git a/src/or/main.c b/src/or/main.c
index cbc3e6db2..16a367187 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -1361,6 +1361,7 @@ tor_free_all(int postfork)
dns_free_all();
clear_pending_onions();
circuit_free_all();
+ helper_nodes_free_all();
connection_free_all();
if (!postfork) {
config_free_all();
diff --git a/src/or/or.h b/src/or/or.h
index c19169630..ad5a0d0d1 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -1396,6 +1396,7 @@ void helper_nodes_set_status_from_directory(void);
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 ***********************/