Skip to content

fix(udp): wrong if statement for chop off.#2227

Merged
gdamore merged 1 commit intonanomsg:mainfrom
wanghaEMQ:wangha/main
Feb 6, 2026
Merged

fix(udp): wrong if statement for chop off.#2227
gdamore merged 1 commit intonanomsg:mainfrom
wanghaEMQ:wangha/main

Conversation

@wanghaEMQ
Copy link
Contributor

@wanghaEMQ wanghaEMQ commented Feb 5, 2026

Summary by CodeRabbit

  • Refactor
    • Reorganized comparison logic in UDP message handling without affecting functionality. Messages exceeding the allowed length continue to be truncated as expected.

@wanghaEMQ wanghaEMQ requested a review from gdamore as a code owner February 5, 2026 07:42
@coderabbitai
Copy link

coderabbitai bot commented Feb 5, 2026

📝 Walkthrough

Walkthrough

A comparison operator in UDP message length validation is reversed from len < nng_msg_len(msg) to nng_msg_len(msg) > len, maintaining equivalent logic with no functional changes to the message handling behavior.

Changes

Cohort / File(s) Summary
UDP Transport Comparison Refactoring
src/sp/transport/udp/udp.c
Swapped comparison operator in udp_recv_data for message length validation; semantically equivalent with no behavioral changes.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

Hop, hop, the logic stays the same,
Just flipped around, a cleaner frame,
With operators swapped with careful care,
The message flows without a snare! 🐰✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request description is empty; the template requires issue reference, synopsis, and comments explaining the change. Add a description following the template: reference the issue number, provide a synopsis, and explain why the comparison change fixes the logic.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: correcting a conditional comparison in the UDP message chopping logic.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gdamore gdamore merged commit 78a54cb into nanomsg:main Feb 6, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants