Mercurial > dnsbl
diff src/dnsbl.cpp @ 18:041ea016b684
add scanning for bare hostnames
author | carl |
---|---|
date | Fri, 30 Apr 2004 00:32:44 -0700 |
parents | 2ae8d953f1d0 |
children | c21b888cc175 |
line wrap: on
line diff
--- a/src/dnsbl.cpp Thu Apr 29 22:05:03 2004 -0700 +++ b/src/dnsbl.cpp Fri Apr 30 00:32:44 2004 -0700 @@ -150,6 +150,7 @@ } static bool debug_syslog = false; +static bool loader_run = true; // used to stop the config loader thread static string_set all_strings; // owns all the strings, only modified by the config loader thread static CONFIG * config = NULL; // protected by the config_mutex @@ -973,8 +974,9 @@ static void* config_loader(void *arg) { typedef set<CONFIG *> configp_set; configp_set old_configs; - while (true) { + while (loader_run) { sleep(180); // look for modifications every 3 minutes + if (!loader_run) break; CONFIG &dc = *config; time_t then = dc.load_time; struct stat st; @@ -1004,6 +1006,7 @@ else i++; } } + return NULL; } @@ -1118,6 +1121,13 @@ fclose(f); } - return smfi_main(); + time_t starting = time(NULL); + int rc = smfi_main(); + if (time(NULL) > starting+5*60) { + my_syslog("trying to restart after smfi_main()"); + loader_run = false; // eventually the config loader thread will terminate + execvp(argv[0], argv); + } + exit((rc == MI_SUCCESS) ? 0 : EX_UNAVAILABLE); }