Skip to content
Browse files

[iface] add human readable interface names to discovered services

  • Loading branch information...
1 parent 836986d commit bdf2230d4d2d2abf1eb1572ba2f2f33ea2154bee @agnat committed Dec 24, 2012
Showing with 6 additions and 4 deletions.
  1. +6 −4 lib/browser.js
View
10 lib/browser.js
@@ -42,6 +42,12 @@ var Browser = exports.Browser = function Browser(serviceType, options) {
};
if (serviceName) service.name = serviceName;
+ if (typeof dns_sd.if_indextoname !== 'undefined' && ifaceIdx > 0) {
+ service.networkInterface = dns_sd.if_indextoname(ifaceIdx);
+ } else if (dns_sd.kDNSServiceInterfaceIndexLocalOnly === ifaceIdx) {
+ service.networkInterface = nif.loopbackName();
+ }
+
if (flags & dns_sd.kDNSServiceFlagsAdd) {
resolve(service,
options.resolverSequence || Browser.defaultResolverSequence,
@@ -92,10 +98,6 @@ Browser.defaultResolverSequence = [
, rst.makeAddressesUnique()
];
-if (typeof dns_sd.if_indextoname !== 'undefined') {
- Browser.defaultResolverSequence.push(rst.networkInterfaceName());
-}
-
exports.browseThemAll = function browseThemAll(options) {
options = options || {}
options.resolverSequence = options.resolverSequence || [];

0 comments on commit bdf2230

Please sign in to comment.
Something went wrong with that request. Please try again.