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 { do {
m_signal = 0; 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)); CDMRGateway* host = new CDMRGateway(std::string(iniFile));
ret = host->run(); ret = host->run();
delete host; delete host;
if (m_signal == 2) switch (m_signal) {
case 2:
::LogInfo("DMRGateway-%s exited on receipt of SIGINT", VERSION); ::LogInfo("DMRGateway-%s exited on receipt of SIGINT", VERSION);
break;
if (m_signal == 15) case 15:
::LogInfo("DMRGateway-%s exited on receipt of SIGTERM", VERSION); ::LogInfo("MDMRGateway-%s exited on receipt of SIGTERM", VERSION);
break;
if (m_signal == 1) case 1:
::LogInfo("DMRGateway-%s restarted on receipt of SIGHUP", VERSION); ::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); } while (m_signal == 1);
::LogFinalise(); ::LogFinalise();