beast: refuse invalid crc

This commit is contained in:
Astro 2022-01-28 21:42:15 +01:00
parent 1c1fe5cfe4
commit 360ced4e7f
1 changed files with 7 additions and 6 deletions

View File

@ -169,14 +169,15 @@ impl Aircrafts {
while let Some(frame) = rx.recv().await { while let Some(frame) = rx.recv().await {
match frame.parse_adsb() { match frame.parse_adsb() {
Some(adsb_deku::Frame { df: adsb_deku::DF::ADSB(adsb), crc }) => { Some(adsb_deku::Frame { df: adsb_deku::DF::ADSB(adsb), crc }) => {
if crc != 0 { if crc == 0 {
state.write().unwrap()
.entry(adsb.icao)
.or_default()
.write().unwrap()
.update(adsb.me);
} else {
eprintln!("crc: {:02X}", crc); eprintln!("crc: {:02X}", crc);
} }
state.write().unwrap()
.entry(adsb.icao)
.or_default()
.write().unwrap()
.update(adsb.me);
} }
_ => {} _ => {}
} }