X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/75547270769394b15e275f4817a824dd75ae3f05..5e7cbf1bbd282c0b18a09c5e77e237a4e20f6e32:/projects/stargazer/main.cpp diff --git a/projects/stargazer/main.cpp b/projects/stargazer/main.cpp index b8857633..702bfb86 100644 --- a/projects/stargazer/main.cpp +++ b/projects/stargazer/main.cpp @@ -221,7 +221,6 @@ if (getuid()) } SETTINGS_IMPL settings(argc == 2 ? argv[1] : ""); -SETTINGS_IMPL newSettings = settings; if (settings.ReadSettings()) { @@ -267,6 +266,11 @@ for (size_t i = 0; i < settings.GetExecutersNum(); i++) PIDFile pidFile(settings.GetPIDFileName()); +struct sigaction sa; +memset(&sa, 0, sizeof(sa)); +sa.sa_handler = SIG_DFL; +sigaction(SIGHUP, &sa, NULL); // Apparently FreeBSD ignores SIGHUP by default when launched from rc.d at bot time. + sigset_t signalSet; sigfillset(&signalSet); pthread_sigmask(SIG_BLOCK, &signalSet, NULL); @@ -339,18 +343,16 @@ while (running) switch (sig) { case SIGHUP: + { + SETTINGS_IMPL newSettings(settings); if (newSettings.ReadSettings()) - { - STG_LOGGER & WriteServLog = GetStgLogger(); - - if (newSettings.GetLogFileName() != "") - WriteServLog.SetLogFileName(newSettings.GetLogFileName()); - WriteServLog("ReadSettings error. %s", newSettings.GetStrError().c_str()); - return -1; - } + else + settings = newSettings; + WriteServLog.SetLogFileName(settings.GetLogFileName()); traffCnt.Reload(); - manager.reload(); + manager.reload(settings); + } break; case SIGTERM: running = false; @@ -374,6 +376,8 @@ while (running) WriteServLog("+++++++++++++++++++++++++++++++++++++++++++++"); +manager.stop(); + if (loop.Stop()) WriteServLog("Event loop not stopped.");