mirror of
https://github.com/jmcorgan/fips.git
synced 2026-08-10 00:26:59 +00:00
The transport layer used Mutex::lock().unwrap() at ten sites across the UDP, BLE, and Ethernet code. A std mutex poisons if a thread panics while holding it, after which every lock().unwrap() on that same mutex also panics, turning one fault into a cascade. These critical sections only perform short HashMap/Vec operations on locally constructed values and are not reachable from peer input, but the idiom is fragile against any future in-section panic. Replace each with lock().unwrap_or_else(|e| e.into_inner()), which recovers the guarded data and removes the cascade with no new dependency and no call-graph change. Also replace four self.local_addr.unwrap() calls in the UDP start and adopt paths with a sentinel fallback. The value is provably set just above each log line today, but the unwrap is brittle against a future reordering; logging an unbound sentinel is harmless and cannot panic.