Skip to main content

connect_moq_reach

Function connect_moq_reach 

Source
pub async fn connect_moq_reach(
    reach: &[Destination],
) -> Result<MoqReachConnection>
Expand description

Resolve a producer’s reach into a live moq subscriber connection (#356).

This is the single reach→connection resolver shared by every networked subscriber (the inference MoqStreamHandle::networked task and the CLI model-load / notify subscribe consumers). It enforces one transport policy in one place. A required native process accepts only Iroh and never takes the compatibility QUIC/UDS alternatives below:

  1. Networked first — dial the first dialable Destination in reach (the producer’s wire-advertised QUIC//moq endpoint) via crate::dial::dial_stream. This is the source of truth: the stream lives wherever the producer advertised, so cross-process / cross- instance subscribers reach it (fixes #142 + the TUI cross-process bug).
  2. Local UDS fallback — only when reach carries NO dialable network reach (UDS-only / unit-test deployments) do we connect to this process’s local moq UDS plane (global_moq_uds_path). The UDS path is resolved from LOCAL knowledge, never from the wire — a same-host fast path, never advertised.
  3. Fail closed — if neither is available, return an error rather than connecting to an empty/wrong plane and timing out.

The UDS fast path is NEVER preferred over a present networked reach: the local UDS plane only carries the producer’s broadcast when the producer is co-located in this very process, so preferring it silently breaks cross-process delivery.