volatile bool is_online = false;
volatile bool webcheck_enabled = false;
volatile bool need_config_reload = false;
+volatile bool exit_now = false;
/**
* Checks if a bpdyndnsd process is already running.
void terminate(int param)
{
updater->get_logger()->print_caught_sigterm();
-
- exit(shutdown());
+ exit_now = true;
} /*lint !e715 */
*/
void reload_config(int param)
{
- updater->get_logger()->print_caught_sighup();
need_config_reload = true;
} /*lint !e715 */
is_online = !updater->get_config()->get_start_offline();
webcheck_enabled = updater->get_config()->get_webcheck_enabled();
+ // One shot run if daemon mode is disabled
+ if (updater->get_config()->get_daemon_mode() != 1)
+ exit_now = true;
+
// service processing starts here
do
{
if (need_config_reload)
{
+ updater->get_logger()->print_caught_sighup();
need_config_reload = false;
if ( updater->reload_config() != 0 )
}
// Snore, snore... don't hog the cpu if we are in daemon_mode.
- if ( updater->get_config()->get_daemon_mode() == 1 )
+ if ( !exit_now )
sleep(10); /*lint !e534 */
-
- }while ( updater->get_config()->get_daemon_mode() == 1 );
+ } while ( !exit_now );
// Serialize services to save their actual state.
if ( shutdown() != 0 )