Skip to main content

start_lan_services

Function start_lan_services 

Source
fn start_lan_services(
    config: &Config,
    event_bus: &Arc<EventBus>,
    version: &str,
    web_port: u16,
    ws_port: u16,
) -> (String, Arc<LanDiscoveryController>, Arc<LanListenerSupervisor>)
Expand description

LAN discovery (mDNS) and the LAN listener supervisor; returns the host name, resolved once because discovery needs it for its mDNS TXT records.

Discovery is opt-in to avoid the Windows Firewall prompt: mDNS binds 0.0.0.0:5353 UDP. The setting defaults to false; users opt in via the HostPopover toggle (or by editing settings.json), and the controller supports live start/stop so flipping it needs no restart (docs/specs/lan-discovery-toggle.md).

Discovery is deliberately NOT applied here. The supervisor is the single driver of lan_discovery.apply, so mDNS can never advertise an endpoint before (or without) a socket actually listening on it. main.rs reads the setting and calls lan_listeners.apply(..) as soon as the router exists (the router it needs to serve), which reconciles listeners and then gates advertising on the result.