From 8830141c4d80ad90184f5aa1e70ee0b97617dba1 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Mon, 29 May 2017 18:52:36 +0100 Subject: [PATCH] Allow for a clean exit when waiting for the MMDVM connect. --- DMRGateway.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/DMRGateway.cpp b/DMRGateway.cpp index 4ab5769..6146513 100644 --- a/DMRGateway.cpp +++ b/DMRGateway.cpp @@ -253,7 +253,7 @@ int CDMRGateway::run() LogMessage("Waiting for MMDVM to connect....."); - for (;;) { + while (!m_killed) { unsigned char config[400U]; unsigned int len = m_repeater->getConfig(config); if (len > 0U) @@ -264,6 +264,13 @@ int CDMRGateway::run() CThread::sleep(10U); } + if (m_killed) { + LogMessage("DMRGateway-%s is exiting on receipt of SIGHUP1", VERSION); + m_repeater->close(); + delete m_repeater; + return 0; + } + LogMessage("MMDVM has connected"); if (m_conf.getDMRNetwork1Enabled()) {