Skip to content

Run mDNS broadcast asynchronously #164

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

Merged
merged 1 commit into from
May 21, 2025
Merged

Run mDNS broadcast asynchronously #164

merged 1 commit into from
May 21, 2025

Conversation

sairon
Copy link
Member

@sairon sairon commented May 20, 2025

Run mDNS in a goroutine so the landing page server starts also in cases when the outbound IP address can't be determined or the mDNS server fails to start for another reason.

This is easy to reproduce when the device has no network connectivity when it starts for the first time. In such case, the landing page errors with "connect: network is unreachable" and never starts after the cable is reconnected, leaving port 8123 unreachable until full Core is downloaded.

Since mDNS is not mission-critical, we shouldn't block the webserver from starting and just start the mDNS asynchronously.

Run mDNS in a goroutine so the landing page server starts also in cases
when the outbound IP address can't be determined or the mDNS server
fails to start for another reason.

This is easy to reproduce when the device has no network connectivity
when it starts for the first time. In such case, the landing page errors
with "connect: network is unreachable" and never starts after the cable
is reconnected, leaving port 8123 unreachable until full Core is
downloaded.

Since mDNS is not mission-critical, we shouldn't block the webserver
from starting and just start the mDNS asynchronously.
sairon added a commit that referenced this pull request May 20, 2025
Outstanding comment mentions the hacky way for obtaining the outbound IP
address should be replaced by API from home-assistant/supervisor#2115.
Poll this API periodically with 5s retry interval in case the IP can't
be determined or parsed from the response.

This still ignores IPv6-only deployment of HA, however, in that case the
landing page should still be reachable, just not discoverable through
mDNS (combined with #164).
@sairon sairon requested a review from agners May 20, 2025 17:05
Copy link
Member

@agners agners left a comment

Choose a reason for hiding this comment

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

LGTM!

@sairon sairon merged commit d09fe59 into main May 21, 2025
25 checks passed
@sairon sairon deleted the mdns-broadcast-goroutine branch May 21, 2025 10:05
sairon added a commit that referenced this pull request May 21, 2025
* Poll for address of Supervisor default interface for mDNS URL

Outstanding comment mentions the hacky way for obtaining the outbound IP
address should be replaced by API from home-assistant/supervisor#2115.
Poll this API periodically with 5s retry interval in case the IP can't
be determined or parsed from the response.

This still ignores IPv6-only deployment of HA, however, in that case the
landing page should still be reachable, just not discoverable through
mDNS (combined with #164).

* Implement setSupervisorAuthHeader for setting bearer token
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants