fix: multiple Advertisements without network #13
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Dnssd fails with
if you create multiple Advertisements on a host with no network available. As far I can tell the reason for this is that the Advertisements share one NetworkInterface, that is shut down when the first Advertisement fails, but there are outstanding that nobody is listening to.
Just adding error handlers to Advertisements do not catch the secondary errors, so somebody using dnssd has no way to guard against this condition.
The PR includes a simple way to demonstrate this with Docker.
I am not familiar enough with dnssd if the fix I included is the way to go. If you have a better way forward please let me know.
My motivation for using dnssd is to be able to work without mdns's native dependencies and possible separate Avahi installation. The original problem that I am solving is that this fails on setups with no internet connection, eg. no gateway and 224.0.0.251:5353 throws ENETUNREACH - the docker incantation is just an easier way to reproduce the issue.