Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix test-domains.js
  • Loading branch information
ry committed Sep 19, 2011
1 parent 8d90ae2 commit 517604b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/dns_uv.js
Expand Up @@ -135,6 +135,10 @@ exports.lookup = function(domain, family, callback) {
} */

function onanswer(status, addresses, familySym) {
if (process.features.domains) {
require('domains').remove(wrap);
}

if (!status) {
callback(null, addresses[0], symToFamily(familySym));
} else {
Expand Down Expand Up @@ -163,6 +167,10 @@ exports.lookup = function(domain, family, callback) {
throw errnoException(errno, 'getHostByName');
}

if (process.features.domains) {
require('domains').add(wrap);
}

callback.immediately = true;
return wrap;
};
Expand All @@ -173,6 +181,10 @@ function resolver(bindingName) {

return function query(name, callback) {
function onanswer(status, result) {
if (process.features.domains) {
require('domains').remove(wrap);
}

if (!status) {
callback(null, result);
} else {
Expand All @@ -186,6 +198,10 @@ function resolver(bindingName) {
throw errnoException(errno, bindingName);
}

if (process.features.domains) {
require('domains').add(wrap);
}

callback.immediately = true;
return wrap;
}
Expand Down

0 comments on commit 517604b

Please sign in to comment.