diff --git a/src/common/analog/AnalogDefines.h b/src/common/analog/AnalogDefines.h index 6fb6a773..17af07ea 100644 --- a/src/common/analog/AnalogDefines.h +++ b/src/common/analog/AnalogDefines.h @@ -38,7 +38,7 @@ namespace analog */ const uint32_t AUDIO_SAMPLES_LENGTH = 160U; //!< Sample size for 20ms of 16-bit audio at 8kHz. - const uint32_t AUDIO_SAMPLES_LENGTH_BYTES = 320U; //!< Sample size for 20ms of 16-bit audio at 8kHz in bytes. + const uint32_t AUDIO_SAMPLES_LENGTH_BYTES = 320U; //!< Sample size for 20ms of 16-bit audio at 8kHz in bytes. (AUDIO_SAMPLES_LENGTH * 2) /** @} */ /** @brief Audio Frame Type(s) */ diff --git a/src/patch/HostPatch.cpp b/src/patch/HostPatch.cpp index c3e8148e..86e5c1c2 100644 --- a/src/patch/HostPatch.cpp +++ b/src/patch/HostPatch.cpp @@ -58,6 +58,7 @@ using namespace network::udp; // --------------------------------------------------------------------------- std::mutex HostPatch::s_networkMutex; +bool HostPatch::s_running = false; // --------------------------------------------------------------------------- // Public Class Members @@ -106,7 +107,6 @@ HostPatch::HostPatch(const std::string& confFile) : m_p25DstCrypto(nullptr), m_netId(P25DEF::WACN_STD_DEFAULT), m_sysId(P25DEF::SID_STD_DEFAULT), - m_running(false), m_trace(false), m_debug(false) { @@ -237,7 +237,7 @@ int HostPatch::run() ::LogInfoEx(LOG_HOST, "Patch is up and running"); - m_running = true; + s_running = true; StopWatch stopWatch; stopWatch.start(); @@ -284,6 +284,8 @@ int HostPatch::run() Thread::sleep(1U); } + s_running = false; + ::LogSetNetwork(nullptr); if (m_network != nullptr) { m_network->close(); @@ -2096,8 +2098,9 @@ void* HostPatch::threadNetworkProcess(void* arg) #endif // _GNU_SOURCE while (!g_killed) { - if (!patch->m_running) { - Thread::sleep(1U); + if (!HostPatch::s_running) { + LogError(LOG_HOST, "HostPatch::threadNetworkProcess(), thread not running"); + Thread::sleep(1000U); continue; } @@ -2186,8 +2189,9 @@ void* HostPatch::threadMMDVMProcess(void* arg) stopWatch.start(); while (!g_killed) { - if (!patch->m_running) { - Thread::sleep(1U); + if (!HostPatch::s_running) { + LogError(LOG_HOST, "HostPatch::threadMMDVMProcess(), thread not running"); + Thread::sleep(1000U); continue; } diff --git a/src/patch/HostPatch.h b/src/patch/HostPatch.h index 74b65cbf..78f83eb0 100644 --- a/src/patch/HostPatch.h +++ b/src/patch/HostPatch.h @@ -119,7 +119,7 @@ private: uint32_t m_netId; uint32_t m_sysId; - bool m_running; + static bool s_running; bool m_trace; bool m_debug; diff --git a/src/patch/network/PeerNetwork.cpp b/src/patch/network/PeerNetwork.cpp index 497760f1..a9235748 100644 --- a/src/patch/network/PeerNetwork.cpp +++ b/src/patch/network/PeerNetwork.cpp @@ -199,7 +199,7 @@ bool PeerNetwork::writeConfig() ::memcpy(buffer + 0U, TAG_REPEATER_CONFIG, 4U); ::snprintf(buffer + 8U, json.length() + 1U, "%s", json.c_str()); - if (m_debug) { + if (m_packetDump) { Utils::dump(1U, "PeerNetowrk::writeConfig(), Message, Configuration", (uint8_t*)buffer, json.length() + 8U); } @@ -278,7 +278,7 @@ UInt8Array PeerNetwork::createP25_LDU1Message_Raw(uint32_t& length, const p25::l buffer[23U] = count; - if (m_debug) + if (m_packetDump) Utils::dump(1U, "PeerNetwork::createP25_LDU1Message_Raw(), Message, P25 LDU1", buffer, (P25_LDU1_PACKET_LENGTH + PACKET_PAD)); length = (P25_LDU1_PACKET_LENGTH + PACKET_PAD); @@ -353,7 +353,7 @@ UInt8Array PeerNetwork::createP25_LDU2Message_Raw(uint32_t& length, const p25::l buffer[23U] = count; - if (m_debug) + if (m_packetDump) Utils::dump(1U, "PeerNetwork::createP25_LDU2Message_Raw(), Message, P25 LDU2", buffer, (P25_LDU2_PACKET_LENGTH + PACKET_PAD)); length = (P25_LDU2_PACKET_LENGTH + PACKET_PAD);