introduce RF loss watchdog to prevent a situation where a frame loss could cause a deadlock; fix message output for TDULC;

pull/35/head
Bryan Biedenkapp 3 years ago
parent 1afad073bc
commit b4bbca3ca5

@ -127,6 +127,7 @@ Control::Control(bool authoritative, uint32_t nac, uint32_t callHang, uint32_t q
m_ccHalted(false),
m_rfTimeout(1000U, timeout),
m_rfTGHang(1000U, tgHang),
m_rfLossWatchdog(1000U, 0U, 1500U),
m_netTimeout(1000U, timeout),
m_networkWatchdog(1000U, 0U, 1500U),
m_ccPacketInterval(1000U, 0U, 10U),
@ -431,6 +432,7 @@ bool Control::processFrame(uint8_t* data, uint32_t len)
// increment the frame loss count by one for audio or data; otherwise drop
// packets
if (m_rfState == RS_RF_AUDIO || m_rfState == RS_RF_DATA) {
m_rfLossWatchdog.start();
++m_frameLossCnt;
}
else {
@ -445,6 +447,12 @@ bool Control::processFrame(uint8_t* data, uint32_t len)
}
}
if (m_rfState == RS_RF_AUDIO || m_rfState == RS_RF_DATA) {
if (m_rfLossWatchdog.isRunning()) {
m_rfLossWatchdog.start();
}
}
if (!sync && m_rfState == RS_RF_LISTENING) {
uint8_t syncBytes[P25_SYNC_LENGTH_BYTES];
::memcpy(syncBytes, data + 2U, P25_SYNC_LENGTH_BYTES);
@ -726,6 +734,18 @@ void Control::clock(uint32_t ms)
}
}
if (m_rfState == RS_RF_AUDIO || m_rfState == RS_RF_DATA) {
if (m_rfLossWatchdog.isRunning()) {
m_rfLossWatchdog.clock(ms);
if (m_rfLossWatchdog.hasExpired()) {
m_rfLossWatchdog.stop();
processFrameLoss();
}
}
}
if (m_netState == RS_NET_AUDIO || m_netState == RS_NET_DATA) {
m_networkWatchdog.clock(ms);

@ -201,6 +201,7 @@ namespace p25
Timer m_rfTimeout;
Timer m_rfTGHang;
Timer m_rfLossWatchdog;
Timer m_netTimeout;
Timer m_networkWatchdog;

@ -710,7 +710,7 @@ bool Voice::process(uint8_t* data, uint32_t len)
else {
std::unique_ptr<lc::TDULC> tdulc = lc::tdulc::TDULCFactory::createTDULC(data + 2U);
if (tdulc == nullptr) {
LogWarning(LOG_RF, P25_LDU2_STR ", undecodable TDULC");
LogWarning(LOG_RF, P25_TDULC_STR ", undecodable TDULC");
}
else {
m_p25->m_trunk->writeRF_TDULC(tdulc.get(), false);

Loading…
Cancel
Save

Powered by TurnKey Linux.