-
Notifications
You must be signed in to change notification settings - Fork 56
Add Network Error Monitoring and Event Notification #415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Previously, failures in set_multicast_if_v4/v6() were only logged at
DEBUG level and silently ignored, causing complete mDNS failure on
affected interfaces without any visible indication.
Example of trace log:
```
2026-01-15T09:11:18.270 TRACE mdns_sd::service_daemon: sending out probing of questions: [DnsQuestion { entry: DnsEntry { name: "6004X00003.local.", ty: ANY, class: 1, cache_flush: false } }, DnsQuestion { entry: DnsEntry { name: "Device 🎵🎵._connect._tcp.local.", ty: ANY, class: 1, cache_flush: false } }]
2026-01-15T09:11:18.270 TRACE mdns_sd::service_daemon: send query: 2 questions 0 answers 3 authorities 0 additional
2026-01-15T09:11:18.270 DEBUG mdns_sd::service_daemon: send_dns_outgoing: failed to set multicast interface for IPv4 192.168.64.61: Cannot assign requested address (os error 99)
2026-01-15T09:11:18.301 TRACE mdns_sd::service_daemon: sending out probing of questions: [DnsQuestion { entry: DnsEntry { name: "6004X00003.local.", ty: ANY, class: 1, cache_flush: false } }, DnsQuestion { entry: DnsEntry { name: "Device 🎵🎵._connect._tcp.local.", ty: ANY, class: 1, cache_flush: false } }]
2026-01-15T09:11:18.301 TRACE mdns_sd::service_daemon: send query: 2 questions 0 answers 3 authorities 0 additional
2026-01-15T09:11:18.302 TRACE mdns_sd::service_daemon: sent out 292 bytes on interface lo (idx 1) addr 127.0.0.1
2026-01-15T09:11:18.302 TRACE mdns_sd::service_daemon: event received with key Token(4)
```
This commits:
- Adds DaemonEvent::NetworkError variant for application monitoring
- Elevates critical network errors from DEBUG to ERROR log level
- Propagates monitor notifications through all network operations
- Ensures all multicast interface errors are captured and reported
Applications can now detect these errors and implement retry logic.
|
Here is the full log file for more context, line 290 This commit allows the app to be aware of this issue, otherwise, this error is silently ignored. |
Add Network Error Monitoring and Event Notification
Summary
This PR adds comprehensive monitoring and notification for critical network errors that occur during mDNS packet transmission. Previously, failures in
set_multicast_if_v4()andset_multicast_if_v6()were only logged at DEBUG level and silently ignored, preventing any mDNS traffic from being sent on affected interfaces without any visible indication to the application.Problem
When
set_multicast_if_v4()orset_multicast_if_v6()fails (commonly with "Cannot assign requested address" - OS error 99), the daemon would:This is a critical error that causes complete mDNS failure on affected interfaces, but was previously invisible to applications using the library.
Example Error Log
I don't have a pattern to reproduce it unfortunately.
Solution
1. New
DaemonEvent::NetworkErrorVariantAdded a new event type that applications can monitor:
2. Elevated Log Level
Changed critical network errors from DEBUG to ERROR level with clear "CRITICAL ERROR" prefix:
3. Automatic Monitor Notification
All network configuration errors now automatically notify monitors, allowing applications to:
4. Complete Monitoring Propagation
Refactored internal functions to accept and propagate
monitorsparameter:send_dns_outgoing_impl()- Now acceptsmonitorsparameterannounce_service_on_intf()- Now propagates monitors to implementationsend_dns_outgoing()- Now accepts and propagates monitorsSome(&mut self.monitors)where availableThis ensures all network errors are captured and reported, not just a subset.
Usage Example
Applications can now monitor for network errors: