Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Fix dns_uv.lookup order

  • Loading branch information...
ry committed Aug 25, 2011
1 parent 5e765fe commit 16b3f2c3ff3eb75b15c95f8bef2b1b39a99ae3cd
Showing with 17 additions and 1 deletion.
  1. +17 −1 lib/dns_uv.js
@@ -142,7 +142,23 @@ exports.lookup = function(domain, family, callback) {
}
}

var wrap = cares.getHostByName(domain, familyToSym(family), onanswer);
var wrap;

if (family) {
// resolve names for explicit address family
var af = familyToSym(family);
wrap = cares.getHostByName(domain, af, onanswer);
} else {
// first resolve names for v4 and if that fails, try v6
wrap = cares.getHostByName(domain, cares.AF_INET, function(err, domains4) {
if (domains4 && domains4.length) {
callback(null, domains4[0], 4);
} else {
cares.getHostByName(domain, cares.AF_INET6, onanswer);
}
});
}

if (!wrap) {
throw errnoException(errno, 'getHostByName');
}

1 comment on commit 16b3f2c

@lordKnighton

This comment has been minimized.

Copy link

commented on 16b3f2c Mar 7, 2016

👍

Please sign in to comment.
You can’t perform that action at this time.