Skip to content

Conversation

@randomdudebunchofnumbers
Copy link

@randomdudebunchofnumbers randomdudebunchofnumbers commented Dec 16, 2025

Summary

Implements dynamic mDNS interface management that gracefully handles network interface availability changes at runtime. Fixes #62

Note: While the primary fix targets configurations with specific interfaces, the monitoring infrastructure benefits all deployment modes by tracking interface state changes.

Changes

Core Implementation:

  • Modified interfaces() method to handle partial interface availability (non-fatal resolution)
  • Added continuous interface monitoring with 15-second polling interval (when specific interfaces configured)
  • Implemented automatic re-announcement when interfaces appear/disappear
  • Added proper cleanup on shutdown to prevent goroutine leaks

Code Quality:

  • Added getUsableInterface() helper function to reduce code duplication
  • Implemented thread-safe state tracking with proper mutex protection
  • Added comprehensive unit tests for new functionality

Key Features

Graceful degradation: Announces on available interfaces even when some are missing
Runtime adaptation: Automatically detects and responds to interface changes (appear/disappear/re-appear)
Backwards compatible: No API changes; existing code continues to work unchanged
Clean shutdown: Proper goroutine lifecycle management prevents resource leaks
Test coverage: Added tests for partial interface availability and helper functions

Behavior

When specific interfaces are configured:

  • ✅ Announces on available interfaces, even if some are missing
  • ✅ Monitors interface state every 15 seconds
  • ✅ Re-announces automatically when interfaces appear or disappear

When no specific interfaces are configured (default):

  • ⚠️ Known limitation: Still announces on the interface list captured at startup
  • ⚠️ Does not yet adapt to runtime interface changes
  • 🔄 Future work: Extend monitoring to detect when new interfaces appear/existing ones disappear

@coveralls
Copy link

coveralls commented Dec 16, 2025

Coverage Status

coverage: 94.494% (-0.5%) from 95.016%
when pulling ff7ab8f on randomdudebunchofnumbers:feat/dynamicMdnsInterfaceManagement
into 09af9aa on enbility:dev.

@randomdudebunchofnumbers
Copy link
Author

I added another commit to fix the broken unit tests. The problem was that two tests used real interface names ("eth0", "eth1") that may exist on CI systems like GitHub Actions runners, causing test failures.

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.

mDNS fails when network interfaces are unavailable at startup or change at runtime

2 participants