Skip to content

Expose typed local browse readiness separately from SearchStarted and daemon liveness #544

Open

Description

@billmcilhargey

Request

Please expose a daemon-owned, typed, point-in-time local readiness snapshot for browsing, separate from DaemonStatus::Running and ServiceEvent::SearchStarted(String). Related: #514 discusses publication readiness and setup bookkeeping; this request is specifically the browsing consumer contract.

Observed source behavior in 0.21.4

exec_command_browse sends SearchStarted before issuing queries, including when my_intfs is empty. Socket creation and multicast join failures can be debug-only. Constructor join failures can still leave addresses in my_intfs; an occupied add_interface entry can also retain an address after a failed join. Thus neither SearchStarted, daemon liveness, nor a positive interface count establishes local socket/membership prerequisites. This is a static source finding, not a claim about a newly reproduced network failure.

Proposed contract

A bounded command/reply operation, ordered on the daemon thread, should return typed per-address/interface outcomes based on actual owned sockets, successful poller setup, current interface selection, retained addresses, and successful multicast membership bookkeeping. Distinguish no selected usable interfaces, missing family sockets, absent membership, and locally initialized interfaces. A monitor alone is insufficient because initialization can precede subscription and bounded monitor queues can lose events. A snapshot should be available even without subscribers.

Successful membership must be tracked per interface/family so an already-held membership on a multi-address interface is not mistaken for failure. Interface disable/removal and last-address leave must invalidate that bookkeeping. Socket TTL/hop setup errors must not be silently treated as success. Reply delivery must not block the daemon if a caller abandons the request.

The result must explicitly mean local prerequisites at a point in time, not packet delivery, completed service resolution, remote reachability, continued multicast health, trusted device identity, or audio interoperability. A quiet LAN with no devices must not be declared failed merely for having no advertisements. Human-readable SearchStarted strings should not need parsing.

Local implementation plan

We are carrying a local patch of the pinned MIT/Apache-2.0 package for this API, with non-networking tests using injected socket/membership state. No upstream implementation acceptance or working network discovery is implied. Happy to align the API with an upstream design rather than retain the carry patch.

Activity

  1. keepsimple1 commented on Nov 9, 2026

    @keepsimple1
    Owner

    Sorry about my delayed reply. Overall this request makes sense. I have an idea to refactor a pending PR #524 to also support this. Will update the PR and get back to you.

  2. keepsimple1 commented on Nov 11, 2026

    @keepsimple1
    Owner

    I've updated the PR #524 to include more info about the socket bind status and multicast membership of each interface. Could you take a look at it and try out the PR branch? And let me know if that works for your needs?

    Specifically, does RunningState (inside the value returned by ServiceDaemon status() call) and its methods offer enough info for you?

  3. keepsimple1 commented on Nov 12, 2026

    @keepsimple1
    Owner

    Here is how the requirements in this issue map to PR #524 :

    This issue asks for PR #524
    Typed, point-in-time snapshot, separate from SearchStarted and liveness ✅ status() → DaemonStatus::Running(RunningState), built when requested
    Handled in order on the daemon thread, request/reply ✅ GetStatus is handled in order with other commands. A status() after enable_interface() reflects the new selection, and one right after new() reflects the joins done at startup.
    Available without subscribers, doesn't depend on monitor events ✅
    Reply never blocks the daemon if the caller goes away ✅ The reply channel is fresh and bounded(1), so the send can't block, and a dropped receiver is only logged.
    Missing family sockets ✅ ipv4_socket() / ipv6_socket() → is_bound(), bind_error()
    Poller setup ✅ new() returns an error if registering the sockets with the poller fails
    No usable interfaces selected ✅ selected_intfs() is empty, or nothing in it is joined
    Absent membership vs. ready interface ✅ Membership::is_joined() / join_error()
    Membership per interface and family, so a second address isn't a failure ✅ An interface without addresses of a family shows None for it, not a failure.
    Disable, removal or last-address removal clears the state ✅ Both joined addresses and recorded join failures are cleared when an address is disabled, invalid, or no longer on the host.
    Local setup only; a quiet LAN isn't a failure ✅ Documented on status() and RunningState, and nothing in the snapshot depends on traffic
    No parsing of SearchStarted strings ✅ No longer needed. SearchStarted itself is unchanged.
    TTL/hop errors not treated as success ❌ Deliberately not done. Failing to set the multicast TTL/hop limit is still only logged (see #515): RFC 6762 says SHOULD, and the socket still works with the OS default.

    For the last item "TTL/hop errors no treated as success", could you share more details about why you'd like to have it and what're the use cases? so that we can look into it again in a separate PR / issue. Thanks!

  4. keepsimple1 commented on Nov 14, 2026

    @keepsimple1
    Owner

    I've merged PR #524 . Could you please give the latest main a try and see if it works for you? Any comments are appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions