Skip to main content

is_self_resolution

Function is_self_resolution 

Source
fn is_self_resolution(
    resolved_port: u16,
    resolved_addrs: &[IpAddr],
    own_port: u16,
    own_addrs: &HashSet<IpAddr>,
) -> bool
Expand description

Pure predicate behind LanDiscovery::resolves_to_this_instance, split out so it can be tested without standing up an mDNS ServiceDaemon.

any rather than all on the address match: a resolution for our own service can legitimately carry an address that interface enumeration missed (they race), and requiring every address to be ours would let that one stray entry resurrect the phantom. any cannot produce a false positive — combined with the port equality, a genuine remote peer would have to be listening on our port at one of our own interface addresses, which it cannot be. Another AgentMux instance on this same host does share our addresses, but never our port.