[fix](trx-server): drop CRC-failed APRS frames before sending to clients
Guard both the live broadcast (decode_tx.send) and the history store (record_aprs_packet) so CRC-failed packets are never forwarded to connected clients or replayed on reconnect. The decode logger still receives all frames for debugging. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
@@ -152,6 +152,9 @@ impl DecoderHistories {
|
||||
}
|
||||
|
||||
pub fn record_aprs_packet(&self, pkt: AprsPacket) {
|
||||
if !pkt.crc_ok {
|
||||
return;
|
||||
}
|
||||
let mut h = self.aprs.lock().expect("aprs history mutex poisoned");
|
||||
h.push_back((Instant::now(), pkt));
|
||||
Self::prune_aprs(&mut h);
|
||||
@@ -773,10 +776,13 @@ pub async fn run_aprs_decoder(
|
||||
|
||||
was_active = true;
|
||||
for pkt in decoder.process_samples(&mono) {
|
||||
histories.record_aprs_packet(pkt.clone());
|
||||
if let Some(logger) = decode_logs.as_ref() {
|
||||
logger.log_aprs(&pkt);
|
||||
}
|
||||
if !pkt.crc_ok {
|
||||
continue;
|
||||
}
|
||||
histories.record_aprs_packet(pkt.clone());
|
||||
let _ = decode_tx.send(DecodedMessage::Aprs(pkt));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user