mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
Freeup main module after module states.
git-svn-id: file:///svn/unbound/trunk@407 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
cc9c205d88
commit
133b65bc67
2 changed files with 21 additions and 19 deletions
|
|
@ -125,6 +125,7 @@ daemon_init()
|
||||||
signal_handling_record();
|
signal_handling_record();
|
||||||
checklock_start();
|
checklock_start();
|
||||||
daemon->need_to_exit = 0;
|
daemon->need_to_exit = 0;
|
||||||
|
daemon->num_modules = 0;
|
||||||
if(!(daemon->env = (struct module_env*)calloc(1,
|
if(!(daemon->env = (struct module_env*)calloc(1,
|
||||||
sizeof(*daemon->env)))) {
|
sizeof(*daemon->env)))) {
|
||||||
free(daemon);
|
free(daemon);
|
||||||
|
|
@ -147,6 +148,22 @@ daemon_open_shared_ports(struct daemon* daemon)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Desetup the modules, deinit, delete.
|
||||||
|
* @param daemon: the daemon.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
daemon_desetup_modules(struct daemon* daemon)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for(i=0; i<daemon->num_modules; i++) {
|
||||||
|
(*daemon->modfunc[i]->deinit)(daemon->env, i);
|
||||||
|
}
|
||||||
|
daemon->num_modules = 0;
|
||||||
|
free(daemon->modfunc);
|
||||||
|
daemon->modfunc = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setup modules. Assigns ids and calls module_init.
|
* Setup modules. Assigns ids and calls module_init.
|
||||||
* @param daemon: the daemon
|
* @param daemon: the daemon
|
||||||
|
|
@ -154,6 +171,8 @@ daemon_open_shared_ports(struct daemon* daemon)
|
||||||
static void daemon_setup_modules(struct daemon* daemon)
|
static void daemon_setup_modules(struct daemon* daemon)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
if(daemon->num_modules != 0)
|
||||||
|
daemon_desetup_modules(daemon);
|
||||||
/* fixed setup of the modules */
|
/* fixed setup of the modules */
|
||||||
daemon->num_modules = 1;
|
daemon->num_modules = 1;
|
||||||
daemon->modfunc = (struct module_func_block**)calloc((size_t)
|
daemon->modfunc = (struct module_func_block**)calloc((size_t)
|
||||||
|
|
@ -290,22 +309,6 @@ daemon_stop_others(struct daemon* daemon)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Desetup the modules, deinit, delete.
|
|
||||||
* @param daemon: the daemon.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
daemon_desetup_modules(struct daemon* daemon)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for(i=0; i<daemon->num_modules; i++) {
|
|
||||||
(*daemon->modfunc[i]->deinit)(daemon->env, i);
|
|
||||||
}
|
|
||||||
daemon->num_modules = 0;
|
|
||||||
free(daemon->modfunc);
|
|
||||||
daemon->modfunc = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
daemon_fork(struct daemon* daemon)
|
daemon_fork(struct daemon* daemon)
|
||||||
{
|
{
|
||||||
|
|
@ -339,9 +342,6 @@ daemon_fork(struct daemon* daemon)
|
||||||
/* we exited! a signal happened! Stop other threads */
|
/* we exited! a signal happened! Stop other threads */
|
||||||
daemon_stop_others(daemon);
|
daemon_stop_others(daemon);
|
||||||
|
|
||||||
/* de-setup modules */
|
|
||||||
daemon_desetup_modules(daemon);
|
|
||||||
|
|
||||||
if(daemon->workers[0]->need_to_restart)
|
if(daemon->workers[0]->need_to_restart)
|
||||||
daemon->need_to_exit = 0;
|
daemon->need_to_exit = 0;
|
||||||
else daemon->need_to_exit = 1;
|
else daemon->need_to_exit = 1;
|
||||||
|
|
@ -369,6 +369,7 @@ daemon_delete(struct daemon* daemon)
|
||||||
{
|
{
|
||||||
if(!daemon)
|
if(!daemon)
|
||||||
return;
|
return;
|
||||||
|
daemon_desetup_modules(daemon);
|
||||||
listening_ports_free(daemon->ports);
|
listening_ports_free(daemon->ports);
|
||||||
if(daemon->env) {
|
if(daemon->env) {
|
||||||
slabhash_delete(daemon->env->msg_cache);
|
slabhash_delete(daemon->env->msg_cache);
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
- set num target queries to 0 when you move them to slumber list.
|
- set num target queries to 0 when you move them to slumber list.
|
||||||
- typo in check caused subquery errors to be ignored, fixed.
|
- typo in check caused subquery errors to be ignored, fixed.
|
||||||
- make lint happy about rlim_t.
|
- make lint happy about rlim_t.
|
||||||
|
- freeup of modules after freeup of module-states.
|
||||||
|
|
||||||
19 June 2007: Wouter
|
19 June 2007: Wouter
|
||||||
- nicer layout in stats.c, review 0.3 change.
|
- nicer layout in stats.c, review 0.3 change.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue