Skip to content

Bind NetworkReceive's ports again when a rebuild prepares it twice - #226

Merged
MoonModules merged 1 commit into
MoonModules:mainfrom
AnjinMeili:networkreceive-rebind
Nov 2, 2026
Merged

MoonModules merged 1 commit into
MoonModules:mainfrom
AnjinMeili:networkreceive-rebind

Conversation

@AnjinMeili

Copy link
Copy Markdown
Contributor

A rebuild that prepares the effect again without a release reported its own ports as in use and stopped receiving. It now closes its three sockets before binding them.

Light domain

  • NetworkReceiveEffect.h: prepare() closes the Art-Net, E1.31 and DDP sockets before opening and binding them.

Tests

  • unit_NetworkReceiveEffect_protocols: binds its ports again on a second prepare.
  • Scenarios skipped: no per-frame change for an RGB wiring; NetworkReceive changed only in prepare.

Docs/CI

  • check_prose: NegatedHeading 6 to 8 and SelfReference 16 to 17 are main's baseline: the committed tree measures the same with this change absent.

Reviews

  • none

What an agent wrote: Claude Code (Opus) wrote the code, the tests and this text from my direction; I reviewed every line and vouch for it.

Tested: On this branch on macOS, 2849 of 2850 desktop tests pass, the new test among them; the one failure is main's discovery test injecting a WLED from 192.168.1.186, which this Mac holds, the bug #225 fixes. Found on a Raspberry Pi 5, where a rebuild left the receiver reporting its own ports in use. check_code ran on this branch before the push.

Skipped checks:

  • collect_kpi skipped: the change runs in prepare(), never per frame.

🤖 Generated with Claude Code

A rebuild that prepares the effect again without a release reported its own ports as in use and stopped receiving. It now closes its three sockets before binding them.

**Light domain**
- NetworkReceiveEffect.h: prepare() closes the Art-Net, E1.31 and DDP sockets before opening and binding them.

**Tests**
- unit_NetworkReceiveEffect_protocols: binds its ports again on a second prepare.
- test_desktop: 2,875 passed on macOS and the Pi 5 (whole branch).
- Scenarios skipped: no per-frame change for an RGB wiring; NetworkReceive changed only in prepare.

**Docs/CI**
- check_prose: NegatedHeading 6 to 8 and SelfReference 16 to 17 are main's baseline: the committed tree measures the same with this change absent.

**Reviews**
- none

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 31, 2026 09:10
@coderabbitai

coderabbitai Bot commented Oct 31, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

There are no active review issues for the change addressing reception loss after repeated prepare() calls.

No open issues 🎉

What changed in this PR

Fixes NetworkReceive stopping reception when a rebuild calls prepare() twice without an intervening release.

Changes:

  • Closes the Art-Net, E1.31, and DDP sockets before reopening and binding them.
  • Adds a regression test checking that a second prepare() succeeds without reporting a bind error.
File Description
test/​unit/​light/​unit_NetworkReceiveEffect_protocols.cpp Adds a repeated-prepare regression test using a heap-allocated rig.
src/​light/​effects/​NetworkReceiveEffect.h Closes all three receive sockets before rebinding during preparation.

Review effort: Balanced

@MoonModules
MoonModules merged commit 6aa1db5 into MoonModules:main Nov 2, 2026
10 checks passed
@ewowi

ewowi commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

Merged, thanks James! Closing before binding is the right fix, closing an unopened socket is safe on all three platforms, and the test pins the second prepare.

ewowi added a commit that referenced this pull request Nov 2, 2026
NdiDriver.h takes #227's per-light read by role. panel-cards.md and 06-advanced.yaml keep this branch's numbering, where "8. Set the card up in LEDVision" puts "When the wall stays dark" at 9.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@AnjinMeili
AnjinMeili deleted the networkreceive-rebind branch November 3, 2026 04:17
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.

4 participants