]> git.stg.codes - stg.git/blobdiff - projects/stargazer/main.cpp
Ticket 37. formatTime() and readTime() methods define added.
[stg.git] / projects / stargazer / main.cpp
index 73786c4efd6c0cc46ba8aa805b9edaca0d9687cb..702bfb8663930c2aca4efb82a4b85cf5a6e6507e 100644 (file)
@@ -266,6 +266,11 @@ for (size_t i = 0; i < settings.GetExecutersNum(); i++)
 
 PIDFile pidFile(settings.GetPIDFileName());
 
 
 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);
 sigset_t signalSet;
 sigfillset(&signalSet);
 pthread_sigmask(SIG_BLOCK, &signalSet, NULL);
@@ -338,8 +343,16 @@ while (running)
     switch (sig)
         {
         case SIGHUP:
     switch (sig)
         {
         case SIGHUP:
+            {
+            SETTINGS_IMPL newSettings(settings);
+            if (newSettings.ReadSettings())
+                WriteServLog("ReadSettings error. %s", newSettings.GetStrError().c_str());
+            else
+                settings = newSettings;
+            WriteServLog.SetLogFileName(settings.GetLogFileName());
             traffCnt.Reload();
             traffCnt.Reload();
-            manager.reload();
+            manager.reload(settings);
+            }
             break;
         case SIGTERM:
             running = false;
             break;
         case SIGTERM:
             running = false;
@@ -363,6 +376,8 @@ while (running)
 
 WriteServLog("+++++++++++++++++++++++++++++++++++++++++++++");
 
 
 WriteServLog("+++++++++++++++++++++++++++++++++++++++++++++");
 
+manager.stop();
+
 if (loop.Stop())
     WriteServLog("Event loop not stopped.");
 
 if (loop.Stop())
     WriteServLog("Event loop not stopped.");