free helper node status info on shutdown

svn:r5177
This commit is contained in:
Nick Mathewson 2005-09-30 21:38:57 +00:00
parent 808e584a87
commit 9e54e2e293
3 changed files with 13 additions and 0 deletions

View File

@ -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) {

View File

@ -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();

View File

@ -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 ***********************/