node_mdns icon indicating copy to clipboard operation
node_mdns copied to clipboard

Null hostname on lo0

Open AlexOwen opened this issue 10 years ago • 1 comments

I am getting a fatal error when a service on the local machine closes down due to the advert not returning a hostname (on OSX). The error is as follows:

events.js:85
      throw er; // Unhandled 'error' event
            ^
TypeError: argument 5 must be a string (hostname)
    at TypeError (native)
    at Array.DNSServiceGetAddrInfo (.../node_modules/mdns/lib/resolver_sequence_tasks.js:93:14)
    at next (.../node_modules/mdns/lib/browser.js:107:21)
    at MDNSService.on_resolver_done (.../mdns/lib/resolver_sequence_tasks.js:33:11)
    at SocketWatcher.MDNSService.self.watcher.callback (.../node_modules/mdns/lib/mdns_service.js:18:40)

The description of the service is this:

{"interfaceIndex":4294967295,"type":{"name":"http","protocol":"tcp","subtypes":[],"fullyQualified":true},"replyDomain":"local.","flags":3,"name":"PC","networkInterface":"lo0"}

Whereas a normal service is this:

{"interfaceIndex":4,"type":{"name":"http","protocol":"tcp","subtypes":[],"fullyQualified":true},"replyDomain":"local.","flags":2,"name":"PC","networkInterface":"en0","fullname":"PC._http._tcp.local.","host":"PC.local.","port":8080}

I can fix this by changing from line 92 in resolver_sequence_tasks.js to this:

if (typeof(service.host) !== 'undefined') {
        dns_sd.DNSServiceGetAddrInfo(
            adr_getter.serviceRef, 0, service.interfaceIndex, family_flags,
            service.host, on_get_addr_info_done, null);

        adr_getter.start();
      }

However I think there is a deeper problem as this occurs even when the networkInterface is set to en0 only.

AlexOwen avatar Apr 23 '15 23:04 AlexOwen

Same problem here.

albohlabs avatar Jul 09 '15 10:07 albohlabs