From b1718f3e0a8eb76ef630f1c463f5c21e71ea5f7b Mon Sep 17 00:00:00 2001 From: Bryan Biedenkapp Date: Wed, 5 Jul 2023 16:39:59 -0400 Subject: [PATCH] fix payload calculation for activity log; correct order of operations for testing if the RF hangtimer is running; --- src/network/FNENetwork.cpp | 2 +- src/p25/packet/Voice.cpp | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/network/FNENetwork.cpp b/src/network/FNENetwork.cpp index 79e3c590..774bd69f 100644 --- a/src/network/FNENetwork.cpp +++ b/src/network/FNENetwork.cpp @@ -517,7 +517,7 @@ void FNENetwork::clock(uint32_t ms) uint8_t rawPayload[length - 11U]; ::memset(rawPayload, 0x00U, length - 11U); ::memcpy(rawPayload, buffer.get() + 11U, length - 11U); - std::string payload(rawPayload, rawPayload + sizeof(rawPayload)); + std::string payload(rawPayload, rawPayload + (length - 11U)); std::stringstream ss; ss << peerId << " " << payload; diff --git a/src/p25/packet/Voice.cpp b/src/p25/packet/Voice.cpp index 2fc1eba2..a9e120d3 100644 --- a/src/p25/packet/Voice.cpp +++ b/src/p25/packet/Voice.cpp @@ -1151,6 +1151,18 @@ void Voice::writeNet_LDU1() uint32_t srcId = control.getSrcId(); bool group = control.getLCO() == LC_GROUP; + // don't process network frames if the destination ID's don't match and the network TG hang timer is running + if (m_p25->m_rfLastDstId != 0U && dstId != 0U) { + if (m_p25->m_rfLastDstId != dstId && (m_p25->m_rfTGHang.isRunning() && !m_p25->m_rfTGHang.hasExpired())) { + resetNet(); + return; + } + + if (m_p25->m_rfLastDstId == dstId && (m_p25->m_rfTGHang.isRunning() && !m_p25->m_rfTGHang.hasExpired())) { + m_p25->m_rfTGHang.start(); + } + } + // ensure our srcId and dstId are sane from the last LDU1 if (m_netLastLDU1.getDstId() != 0U) { if (dstId != m_netLastLDU1.getDstId()) { @@ -1181,18 +1193,6 @@ void Voice::writeNet_LDU1() return; } - // don't process network frames if the destination ID's don't match and the network TG hang timer is running - if (m_p25->m_rfLastDstId != 0U) { - if (m_p25->m_rfLastDstId != dstId && (m_p25->m_rfTGHang.isRunning() && !m_p25->m_rfTGHang.hasExpired())) { - resetNet(); - return; - } - - if (m_p25->m_rfLastDstId == dstId && (m_p25->m_rfTGHang.isRunning() && !m_p25->m_rfTGHang.hasExpired())) { - m_p25->m_rfTGHang.start(); - } - } - // don't process network frames if the RF modem isn't in a listening state if (m_p25->m_rfState != RS_RF_LISTENING) { if (m_rfLC.getSrcId() == srcId && m_rfLC.getDstId() == dstId) {