Skip to content

Fix ENODATA and unrecognised POSIX errors not treated as disconnections#64

Merged
Keith-wright merged 1 commit intomainfrom
fix-enodata-disconnection
Mar 3, 2026
Merged

Fix ENODATA and unrecognised POSIX errors not treated as disconnections#64
Keith-wright merged 1 commit intomainfrom
fix-enodata-disconnection

Conversation

@Keith-wright
Copy link
Contributor

Fixes #62

When a WebSocket connection receives POSIX error 96 (ENODATA: "No message available on STREAM"), the previous isDisconnectionNWError check did not recognise it, leaving the NWConnection in a zombie .ready state. Subsequent reconnect attempts would reuse the dead connection and immediately fail with the same error, causing an unrecoverable reconnection loop.

Changes

  • Add a catch-all else if case .posix(_) branch to isDisconnectionNWError to handle ENODATA and any other unrecognised POSIX errors that also indicate a dead connection
  • Call connection?.cancel() before scheduling disconnection reporting to ensure the zombie NWConnection is torn down so a fresh one is created on reconnect
  • Bump version to 0.5.10

Thanks to @joelmbell for the suggestion in #63.

Copy link

@joelmbell joelmbell left a comment

Choose a reason for hiding this comment

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

Thank you!

Copy link
Member

@aonemd aonemd left a comment

Choose a reason for hiding this comment

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

👍

@aonemd aonemd added release Preparing for a new release and removed release Preparing for a new release labels Mar 3, 2026
@Keith-wright Keith-wright merged commit 69e3e44 into main Mar 3, 2026
4 checks passed
@Keith-wright Keith-wright deleted the fix-enodata-disconnection branch March 3, 2026 16:55
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.

ENODATA isn't treated as a disconnection error and can cause a misleading "ready" state

4 participants