wifi-densepose/v2/crates/cog-ha-matter/src
ruv 07b792715f cog-ha-matter (ADR-116 P4): live mDNS responder + handle
Closes the mDNS half of P4. `runtime::start_mdns_responder` binds
multicast via `mdns_sd::ServiceDaemon::new`, builds the
ServiceInfo from `MdnsService::to_service_info` (iter 9), and
registers — returning a typed handle that owns both daemon and
fullname.

Handle shape:

  pub struct MdnsResponderHandle {
      daemon: ServiceDaemon,
      fullname: String,
  }

  impl MdnsResponderHandle {
      pub fn fullname(&self) -> &str;
      pub fn shutdown(self) -> Result<(), mdns_sd::Error>;
  }
  impl Drop for MdnsResponderHandle { /* best-effort */ }

Why explicit `shutdown` + best-effort `Drop`: a clean shutdown
sends a goodbye packet so HA's discovery integration sees the
service leave (good UX — no stale device card). `Drop` is the
fallback for panics / process termination but swallows errors
since panicking-in-Drop would mask the real failure.

1 new live-I/O test:
  * mdns_responder_fullname_concatenates_instance_and_service_type
    — actually binds multicast on the loopback adapter, registers,
    asserts the fullname contains `_ruview-ha._tcp`, then
    shutdown()s. Confirmed working on Windows; CI environments
    where multicast bind is filtered will hit the gracefully-
    skipping early return rather than failing the suite.

64/64 cog tests green (63 → 64).

ADR-116 P4: mDNS half  (record-builder + ServiceInfo + live
responder), witness half  (chain + JSONL + file + Ed25519).
Last piece is the embedded rumqttd broker so external mosquitto
becomes optional.

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-05-23 18:31:38 -04:00
..
lib.rs cog-ha-matter (ADR-116 P4): Ed25519 signing layer for witness chain 2026-05-23 18:22:15 -04:00
main.rs cog-ha-matter (ADR-116 P3): wire publisher::spawn into main.rs 2026-05-23 17:59:02 -04:00
manifest.rs feat(cog-ha-matter): P2 scaffold + ADR-116 P1 research-dossier fold-in 2026-05-23 17:48:08 -04:00
mdns.rs cog-ha-matter (ADR-116 P4): MdnsService -> mdns-sd ServiceInfo bridge 2026-05-23 18:28:10 -04:00
runtime.rs cog-ha-matter (ADR-116 P4): live mDNS responder + handle 2026-05-23 18:31:38 -04:00
witness.rs cog-ha-matter (ADR-116 P4): witness file persistence + chain-level verify 2026-05-23 18:19:05 -04:00
witness_signing.rs cog-ha-matter (ADR-116 P4): Ed25519 signing layer for witness chain 2026-05-23 18:22:15 -04:00