Upgrade the signal handling.

This commit is contained in:
Jonathan Naylor 2024-08-28 16:53:25 +01:00
parent e1e41be3a0
commit 6d42e46285

View file

@ -101,21 +101,27 @@ int main(int argc, char** argv)
do {
m_signal = 0;
m_killed = false; // restart, don't exit, if looping from SIGHUP (1)
m_killed = false;
CDMRGateway* host = new CDMRGateway(std::string(iniFile));
ret = host->run();
delete host;
if (m_signal == 2)
::LogInfo("DMRGateway-%s exited on receipt of SIGINT", VERSION);
if (m_signal == 15)
::LogInfo("DMRGateway-%s exited on receipt of SIGTERM", VERSION);
if (m_signal == 1)
::LogInfo("DMRGateway-%s restarted on receipt of SIGHUP", VERSION);
switch (m_signal) {
case 2:
::LogInfo("DMRGateway-%s exited on receipt of SIGINT", VERSION);
break;
case 15:
::LogInfo("MDMRGateway-%s exited on receipt of SIGTERM", VERSION);
break;
case 1:
::LogInfo("DMRGateway-%s is restarting on receipt of SIGHUP", VERSION);
break;
default:
::LogInfo("DMRGateway-%s exited on receipt of an unknown signal", VERSION);
break;
}
} while (m_signal == 1);
::LogFinalise();