fix(canopen): stop a block download's sub-block batch when the transfer ends - #259
Conversation
…er ends SendNextBlockDownloadSubBlock sends up to 127 segments as one ordered batch with no way to stop it. When the server aborted, the caller cancelled or the transfer ended otherwise while the batch was still going, only the client session was removed and the remaining segments were sent anyway. The server has no block session then and reads each segment as a command specifier: a seqno of 0x20..0x3F is a classic download initiate, and 0x23, 0x27, 0x2B and 0x2F are expedited writes that land in the dictionary when the bytes that happen to be the multiplexer name a writable object of that width. The batch now asks before each frame whether the transfer's task is complete, which every way of ending it sets and which is readable from the sending task. The upload server's batch is not touched; its peer is a client that ignores stray segments. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
PR SummaryMedium Risk Overview
A new test covers server abort and caller cancel mid sub-block (first segment held on deferred echo) and asserts no further segments are transmitted. Reviewed by Cursor Bugbot for commit c0bdff5. Bugbot is set up for automated code reviews on this repo. Configure here. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
What does this change?
Fixes finding C9 of the 2026-09-30 deep review: a block download sent its sub-block as one ordered batch that nothing could stop. After a server abort or a cancel the rest of the segments still went out, and a server without a session reads them as command specifiers, in the worst case as expedited writes into its dictionary. The batch now checks before each frame whether the transfer's task is complete.
Type of change
feat— new behaviour (minor release)fix/perf— bug or performance fix (patch release)docs/test/refactor/chore/ci— no release!in the title, plus aBREAKING CHANGE:footer explaining the migration)Checklist
dotnet build CanKit.Pro.sln -c Releasesucceeds (with-p:CI=true)dotnet test CanKit.Pro.sln -c Releasepasses (net10.0,--no-build)Also run:
dotnet format --verify-no-changes,dotnet pack+eng/verify-packages.py.Notes
🤖 Generated with Claude Code