Skip to content

Conversation

@DerAndereAndi
Copy link
Member

This change fixes infinite warning logs when network interfaces disconnect
during mDNS operations. Previously, the code would continue attempting to
send to disconnected interfaces, generating warnings on every attempt.

Key changes:

  • Add InterfaceManager to track active/failed interfaces with adaptive backoff
  • Add error classification (isInterfaceGone) to detect interface failures
  • Update Client and Server to use InterfaceManager for dynamic iteration
  • Fix Windows conn wrappers to return errors instead of logging them
  • Add integration tests that simulate the original disconnect scenario

The fix uses separate IPv4/IPv6 managers to prevent cross-protocol failure
cascades. When an interface fails with ENXIO, ENETDOWN, or similar errors,
it's immediately removed from the active set. Recovery is attempted with
adaptive backoff (1s, 5s, 30s) when interfaces reappear.

This required the PR #3
It fixes #1

Breaking change release targeting:
- Proper interfaces for testability
- Dependency injection
- Generated mocks
- Improved test coverage
- Removal of global state
- Add api/ package with PacketConn, ConnectionFactory, InterfaceProvider interfaces
- Add mocks/ package with mockery-generated mocks for testing
- Split connection.go into conn_factory.go, conn_ipv4.go, conn_ipv6.go, conn_provider.go
- Rename connection.go to mdns.go (contains only mDNS constants)
- Export Client type and add NewClient() constructor
- Add WithClientConnFactory and WithServerConnFactory options for mock injection
- Remove deprecated Server.TTL() method
- Add comprehensive unit tests (87.6% coverage)
- Update README with v3 examples and testing documentation
- Bump version to v3.0.0

Breaking changes:
- Browse() now requires a 'removed' channel parameter
- Module path is github.com/enbility/zeroconf/v3
This change fixes infinite warning logs when network interfaces disconnect
during mDNS operations. Previously, the code would continue attempting to
send to disconnected interfaces, generating warnings on every attempt.

Key changes:
- Add InterfaceManager to track active/failed interfaces with adaptive backoff
- Add error classification (isInterfaceGone) to detect interface failures
- Update Client and Server to use InterfaceManager for dynamic iteration
- Fix Windows conn wrappers to return errors instead of logging them
- Add integration tests that simulate the original disconnect scenario

The fix uses separate IPv4/IPv6 managers to prevent cross-protocol failure
cascades. When an interface fails with ENXIO, ENETDOWN, or similar errors,
it's immediately removed from the active set. Recovery is attempted with
adaptive backoff (1s, 5s, 30s) when interfaces reappear.
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.

Failed to set multicast interface: no such interface

2 participants