mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-21 06:55:52 +08:00
Add SIGINT handling and alter termination signal logging
This commit is contained in:
@@ -95,6 +95,7 @@ int main(int argc, char** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(_WIN32) && !defined(_WIN64)
|
#if !defined(_WIN32) && !defined(_WIN64)
|
||||||
|
::signal(SIGINT, sigHandler);
|
||||||
::signal(SIGTERM, sigHandler);
|
::signal(SIGTERM, sigHandler);
|
||||||
::signal(SIGHUP, sigHandler);
|
::signal(SIGHUP, sigHandler);
|
||||||
#endif
|
#endif
|
||||||
@@ -109,11 +110,14 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
delete host;
|
delete host;
|
||||||
|
|
||||||
|
if (m_signal == 2)
|
||||||
|
::LogInfo("MMDVMHost-%s is exited on receipt of SIGINT", VERSION);
|
||||||
|
|
||||||
if (m_signal == 15)
|
if (m_signal == 15)
|
||||||
::LogInfo("Caught SIGTERM, exiting");
|
::LogInfo("MMDVMHost-%s is exited on receipt of SIGTERM", VERSION);
|
||||||
|
|
||||||
if (m_signal == 1)
|
if (m_signal == 1)
|
||||||
::LogInfo("Caught SIGHUP, restarting");
|
::LogInfo("MMDVMHost-%s is restarting on receipt of SIGHUP", VERSION);
|
||||||
} while (m_signal == 1);
|
} while (m_signal == 1);
|
||||||
|
|
||||||
::LogFinalise();
|
::LogFinalise();
|
||||||
@@ -745,8 +749,6 @@ int CMMDVMHost::run()
|
|||||||
CThread::sleep(5U);
|
CThread::sleep(5U);
|
||||||
}
|
}
|
||||||
|
|
||||||
LogMessage("MMDVMHost-%s is exiting on receipt of SIGHUP1", VERSION);
|
|
||||||
|
|
||||||
setMode(MODE_IDLE);
|
setMode(MODE_IDLE);
|
||||||
|
|
||||||
m_modem->close();
|
m_modem->close();
|
||||||
|
|||||||
Reference in New Issue
Block a user