fix(radio): replace beginSending() asserts with graceful rejection - #11233
fix(radio): replace beginSending() asserts with graceful rejection#11233ndoo wants to merge 1 commit into
Conversation
assert(!sendingPacket)/assert(payload variant)/assert(from)/assert(size) in RadioInterface::beginSending() all hang forever with no diagnostic on STM32WL instead of dropping one packet. Return 0 and release p on any violated invariant instead. Updated both callers (RadioLibInterface::startSend(), SimRadio::startSend()) to check for a 0 return and bail out without touching the now-released packet. Assisted-by: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Andrew Yong <me@ndoo.sg>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
⚡ Try this PR in the Web FlasherNote Building this pull request… the flash button, badges and supported-board |
|
Closing — this is superseded by @t-miura's #11223 (the |
Problem
RadioInterface::beginSending()guards four invariants withassert(): no send already in progress, payload already encrypted, sender node num set, and encrypted payload fits the radio buffer. On STM32WL these all hang forever with no diagnostic instead of dropping the one bad packet (__wrap___assert_funciswhile(true);).Fix
Convert each
assert()to a checked early return: log, releasep, return 0. Both callers (RadioLibInterface::startSend(),SimRadio::startSend()) are updated to check for a 0 return and bail out cleanly instead of proceeding to transmit/use the now-released packet.Test plan
pio run -e wio-e5/pio run -e rak3172/pio run -e native-macos— build clean (native-macos exercises theSimRadio.cppcaller).🤝 Attestations