From 0b63fa6a230de95fba1df81be146e3e5333a0bd1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 8 Jul 2023 13:28:53 +0200 Subject: [PATCH] replace some more expects --- satrs-example/src/tmtc.rs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/satrs-example/src/tmtc.rs b/satrs-example/src/tmtc.rs index 6a4fb2f..ddc7f46 100644 --- a/satrs-example/src/tmtc.rs +++ b/satrs-example/src/tmtc.rs @@ -204,12 +204,21 @@ fn poll_tc_server(udp_tmtc_server: &mut UdpTmtcServer) -> bool { fn core_tm_handling(udp_tmtc_server: &mut UdpTmtcServer, recv_addr: &SocketAddr) { while let Ok(addr) = udp_tmtc_server.tm_rx.try_recv() { - let mut store_lock = udp_tmtc_server + let store_lock = udp_tmtc_server .tm_store - .write() - .expect("locking TM store failed"); + .write(); + if store_lock.is_err() { + warn!("Locking TM store failed"); + continue; + } + let mut store_lock = store_lock.unwrap(); let pg = store_lock.read_with_guard(addr); - let buf = pg.read().expect("error reading TM pool data"); + let read_res = pg.read(); + if read_res.is_err() { + warn!("Error reading TM pool data"); + continue; + } + let buf = read_res.unwrap(); if buf.len() > 9 { let service = buf[7]; let subservice = buf[8];