Fixup for signal handling. No more dangling unbound processes after

test suite.


git-svn-id: file:///svn/unbound/trunk@739 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2007-11-12 11:10:11 +00:00
parent 7c5182d3fd
commit 0ee5532396
5 changed files with 13 additions and 12 deletions

View file

@ -108,10 +108,10 @@ signal_handling_record()
static void
signal_handling_playback(struct worker* wrk)
{
if(sig_record_quit)
worker_sighandler(SIGTERM, wrk);
if(sig_record_reload)
worker_sighandler(SIGHUP, wrk);
if(sig_record_quit)
worker_sighandler(SIGTERM, wrk);
sig_record_quit = 0;
sig_record_reload = 0;
}
@ -425,9 +425,7 @@ daemon_fork(struct daemon* daemon)
/* we exited! a signal happened! Stop other threads */
daemon_stop_others(daemon);
if(daemon->workers[0]->need_to_restart)
daemon->need_to_exit = 0;
else daemon->need_to_exit = 1;
daemon->need_to_exit = daemon->workers[0]->need_to_exit;
}
void

View file

@ -790,22 +790,21 @@ worker_sighandler(int sig, void* arg)
switch(sig) {
case SIGHUP:
verbose(VERB_DETAIL, "caught signal SIGHUP");
worker->need_to_restart = 1;
comm_base_exit(worker->base);
break;
case SIGINT:
verbose(VERB_DETAIL, "caught signal SIGINT");
worker->need_to_restart = 0;
worker->need_to_exit = 1;
comm_base_exit(worker->base);
break;
case SIGQUIT:
verbose(VERB_DETAIL, "caught signal SIGQUIT");
worker->need_to_restart = 0;
worker->need_to_exit = 1;
comm_base_exit(worker->base);
break;
case SIGTERM:
verbose(VERB_DETAIL, "caught signal SIGTERM");
worker->need_to_restart = 0;
worker->need_to_exit = 1;
comm_base_exit(worker->base);
break;
default:
@ -851,7 +850,7 @@ worker_init(struct worker* worker, struct config_file *cfg,
{
unsigned int seed;
int startport;
worker->need_to_restart = 0;
worker->need_to_exit = 0;
worker->base = comm_base_create();
if(!worker->base) {
log_err("could not create event handling base");

View file

@ -99,8 +99,8 @@ struct worker {
/** random() table for this worker. */
struct ub_randstate* rndstate;
/** do we need to restart (instead of exit) ? */
int need_to_restart;
/** do we need to restart or quit (on signal) */
int need_to_exit;
/** allocation cache for this thread */
struct alloc_cache alloc;
/** per thread statistics */

View file

@ -1,3 +1,7 @@
12 November 2007: Wouter
- fixup signal handling where SIGTERM could be ignored if a SIGHUP
arrives later on.
9 November 2007: Wouter
- took ldns snapshot in repo.
- default config file is /etc/unbound/unbound.conf.

Binary file not shown.