mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-23 08:45:48 +08:00
Merge branch 'master' into mqtt
This commit is contained in:
@@ -82,7 +82,7 @@ static void sigHandler2(int signum)
|
||||
const char* HEADER1 = "This software is for use on amateur radio networks only,";
|
||||
const char* HEADER2 = "it is to be used for educational purposes only. Its use on";
|
||||
const char* HEADER3 = "commercial networks is strictly prohibited.";
|
||||
const char* HEADER4 = "Copyright(C) 2015-2021 by Jonathan Naylor, G4KLX and others";
|
||||
const char* HEADER4 = "Copyright(C) 2015-2023 by Jonathan Naylor, G4KLX and others";
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
@@ -119,15 +119,24 @@ int main(int argc, char** argv)
|
||||
|
||||
delete host;
|
||||
|
||||
if (m_signal == 2)
|
||||
::LogInfo("MMDVMHost-%s exited on receipt of SIGINT", VERSION);
|
||||
|
||||
if (m_signal == 15)
|
||||
::LogInfo("MMDVMHost-%s exited on receipt of SIGTERM", VERSION);
|
||||
|
||||
if (m_signal == 1)
|
||||
::LogInfo("MMDVMHost-%s is restarting on receipt of SIGHUP", VERSION);
|
||||
} while (m_signal == 1);
|
||||
switch (m_signal) {
|
||||
case 2:
|
||||
::LogInfo("MMDVMHost-%s exited on receipt of SIGINT", VERSION);
|
||||
break;
|
||||
case 15:
|
||||
::LogInfo("MMDVMHost-%s exited on receipt of SIGTERM", VERSION);
|
||||
break;
|
||||
case 1:
|
||||
::LogInfo("MMDVMHost-%s exited on receipt of SIGHUP", VERSION);
|
||||
break;
|
||||
case 10:
|
||||
::LogInfo("MMDVMHost-%s is restarting on receipt of SIGUSR1", VERSION);
|
||||
break;
|
||||
default:
|
||||
::LogInfo("MMDVMHost-%s exited on receipt of an unknown signal", VERSION);
|
||||
break;
|
||||
}
|
||||
} while (m_signal == 10);
|
||||
|
||||
::LogFinalise();
|
||||
|
||||
@@ -303,8 +312,8 @@ int CMMDVMHost::run()
|
||||
LogInfo(HEADER3);
|
||||
LogInfo(HEADER4);
|
||||
|
||||
LogMessage("MMDVMHost-%s is starting", VERSION);
|
||||
LogMessage("Built %s %s (GitID #%.7s)", __TIME__, __DATE__, gitversion);
|
||||
LogInfo("MMDVMHost-%s is starting", VERSION);
|
||||
LogInfo("Built %s %s (GitID #%.7s)", __TIME__, __DATE__, gitversion);
|
||||
|
||||
readParams();
|
||||
|
||||
@@ -359,6 +368,8 @@ int CMMDVMHost::run()
|
||||
|
||||
m_display = CDisplay::createDisplay(m_conf, m_modem);
|
||||
|
||||
LogInfo("Opening network connections");
|
||||
|
||||
if (m_dstarEnabled && m_conf.getDStarNetworkEnabled()) {
|
||||
ret = createDStarNetwork();
|
||||
if (!ret)
|
||||
@@ -494,6 +505,8 @@ int CMMDVMHost::run()
|
||||
m_dmrLookup->read();
|
||||
}
|
||||
|
||||
LogInfo("Starting protocol handlers");
|
||||
|
||||
CStopWatch stopWatch;
|
||||
stopWatch.start();
|
||||
|
||||
@@ -771,7 +784,7 @@ int CMMDVMHost::run()
|
||||
|
||||
setMode(MODE_IDLE);
|
||||
|
||||
LogMessage("MMDVMHost-%s is running", VERSION);
|
||||
LogInfo("MMDVMHost-%s is running", VERSION);
|
||||
|
||||
while (!m_killed) {
|
||||
bool lockout = m_modem->hasLockout();
|
||||
@@ -1313,18 +1326,14 @@ int CMMDVMHost::run()
|
||||
|
||||
setMode(MODE_QUIT);
|
||||
|
||||
m_modem->close();
|
||||
delete m_modem;
|
||||
|
||||
m_display->close();
|
||||
delete m_display;
|
||||
|
||||
if (m_dmrLookup != NULL)
|
||||
m_dmrLookup->stop();
|
||||
|
||||
if (m_nxdnLookup != NULL)
|
||||
m_nxdnLookup->stop();
|
||||
|
||||
LogInfo("Closing network connections");
|
||||
|
||||
if (m_dstarNetwork != NULL) {
|
||||
m_dstarNetwork->close();
|
||||
delete m_dstarNetwork;
|
||||
@@ -1380,10 +1389,7 @@ int CMMDVMHost::run()
|
||||
delete m_remoteControl;
|
||||
}
|
||||
|
||||
if (m_mqtt != NULL) {
|
||||
m_mqtt->close();
|
||||
delete m_mqtt;
|
||||
}
|
||||
LogInfo("Stopping protocol handlers");
|
||||
|
||||
delete m_dstar;
|
||||
delete m_dmr;
|
||||
@@ -1395,6 +1401,19 @@ int CMMDVMHost::run()
|
||||
delete m_fm;
|
||||
delete m_ax25;
|
||||
|
||||
LogInfo("MMDVMHost-%s has stopped", VERSION);
|
||||
|
||||
m_modem->close();
|
||||
delete m_modem;
|
||||
|
||||
m_display->close();
|
||||
delete m_display;
|
||||
|
||||
if (m_mqtt != NULL) {
|
||||
m_mqtt->close();
|
||||
delete m_mqtt;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user