Skip to content

fix(base): 🐛 make socket-closed detection portable to Windows#666

Merged
rhammen merged 1 commit into
mainfrom
fix/windows-socket-closed-detection
Jul 4, 2026
Merged

fix(base): 🐛 make socket-closed detection portable to Windows#666
rhammen merged 1 commit into
mainfrom
fix/windows-socket-closed-detection

Conversation

@rhammen

@rhammen rhammen commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator
  • replace socket.MSG_DONTWAIT (POSIX-only, missing on Windows) with settimeout(0), which puts the socket into non-blocking mode portably and raises the same BlockingIOError the existing handler expects
  • MSG_PEEK alone still reads without consuming the data

Fixes 3 tests in TestIsSocketClosed that previously failed on Windows because evaluating socket.MSG_DONTWAIT raised AttributeError before recv() was ever reached, silently falling through to the generic exception handler instead of exercising the intended branch.

- replace socket.MSG_DONTWAIT (POSIX-only, missing on Windows) with
  settimeout(0), which puts the socket into non-blocking mode portably
  and raises the same BlockingIOError the existing handler expects
- MSG_PEEK alone still reads without consuming the data

Fixes 3 tests in TestIsSocketClosed that previously failed on Windows
because evaluating socket.MSG_DONTWAIT raised AttributeError before
recv() was ever reached, silently falling through to the generic
exception handler instead of exercising the intended branch.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Code Coverage

Package Line Rate Health
custom_components.luxtronik2 100%
Summary 100% (2880 / 2880)

@rhammen rhammen merged commit 99aba84 into main Jul 4, 2026
9 checks passed
@rhammen rhammen deleted the fix/windows-socket-closed-detection branch July 4, 2026 16:19
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.

1 participant