Moved the filter_destroy() logic from inside the signal handler. It's now

been moved to inside the main() function.
This commit is contained in:
Robert James Kaes 2002-04-18 17:04:04 +00:00
parent 5822ec3d44
commit 43860d2469
2 changed files with 10 additions and 6 deletions

View File

@ -1,5 +1,9 @@
2002-04-18 Robert James Kaes <rjkaes@flarenet.com> 2002-04-18 Robert James Kaes <rjkaes@flarenet.com>
* src/tinyproxy.c (takesig): Moved the filter_destroy() code out
of the signal handler and placed it inside of main(). Same
reasoning as the rotate_log_files() changes below.
* src/utils.c (rotate_log_files): Moved the log rotation code out * src/utils.c (rotate_log_files): Moved the log rotation code out
of the signal handler and into it's own function. Also improved of the signal handler and into it's own function. Also improved
the robustness of the code. Credit to Petr Lampa for suggesting the robustness of the code. Credit to Petr Lampa for suggesting

View File

@ -1,4 +1,4 @@
/* $Id: tinyproxy.c,v 1.25 2002-04-18 16:57:06 rjkaes Exp $ /* $Id: tinyproxy.c,v 1.26 2002-04-18 17:04:04 rjkaes Exp $
* *
* The initialise routine. Basically sets up all the initial stuff (logfile, * The initialise routine. Basically sets up all the initial stuff (logfile,
* listening socket, config options, etc.) and then sits there and loops * listening socket, config options, etc.) and then sits there and loops
@ -58,12 +58,7 @@ takesig(int sig)
break; break;
case SIGTERM: case SIGTERM:
#ifdef FILTER_ENABLE
if (config.filter)
filter_destroy();
#endif /* FILTER_ENABLE */
config.quit = TRUE; config.quit = TRUE;
log_message(LOG_INFO, "SIGTERM received.");
break; break;
} }
@ -383,6 +378,11 @@ main(int argc, char **argv)
thread_main_loop(); thread_main_loop();
#ifdef FILTER_ENABLE
if (config.filter)
filter_destroy();
#endif
log_message(LOG_INFO, "Shutting down."); log_message(LOG_INFO, "Shutting down.");
thread_kill_threads(); thread_kill_threads();