mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-21 15:09:23 +08:00
Handle restarts with SIGHUP.
This commit is contained in:
@@ -74,20 +74,26 @@ int main(int argc, char** argv)
|
|||||||
::signal(SIGHUP, sigHandler);
|
::signal(SIGHUP, sigHandler);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CMMDVMHost* host = new CMMDVMHost(std::string(iniFile));
|
int ret = 0;
|
||||||
int ret2 = host->run();
|
|
||||||
|
|
||||||
delete host;
|
do {
|
||||||
|
m_signal = 0;
|
||||||
|
|
||||||
if (m_signal == 15)
|
CMMDVMHost* host = new CMMDVMHost(std::string(iniFile));
|
||||||
::LogInfo("Caught SIGTERM. Exiting");
|
ret = host->run();
|
||||||
|
|
||||||
if (m_signal == 1)
|
delete host;
|
||||||
::LogInfo("Caught SIGHUP. Exiting");
|
|
||||||
|
if (m_signal == 15)
|
||||||
|
::LogInfo("Caught SIGTERM, exiting");
|
||||||
|
|
||||||
|
if (m_signal == 1)
|
||||||
|
::LogInfo("Caught SIGHUP, restarting");
|
||||||
|
} while (m_signal == 1);
|
||||||
|
|
||||||
::LogFinalise();
|
::LogFinalise();
|
||||||
|
|
||||||
return ret2;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
CMMDVMHost::CMMDVMHost(const std::string& confFile) :
|
CMMDVMHost::CMMDVMHost(const std::string& confFile) :
|
||||||
|
|||||||
Reference in New Issue
Block a user