made mDNS query for paywall check more error resistant

This commit is contained in:
tigerbot 2017-07-14 17:04:24 -06:00
parent 95d5526f28
commit 6ba0cac3f3
1 changed files with 2 additions and 6 deletions

View File

@ -85,12 +85,8 @@ module.exports.create = function (deps, conf) {
var dns = PromiseA.promisifyAll(require('dns')); var dns = PromiseA.promisifyAll(require('dns'));
var proms = testDomains.map(function (dom) { var proms = testDomains.map(function (dom) {
return dns.resolve6Async(dom) return dns.resolve6Async(dom)
.catch(function (err) { .catch(function () {
if (err.code === 'ENODATA') {
return dns.resolve4Async(dom); return dns.resolve4Async(dom);
} else {
return PromiseA.reject(err);
}
}) })
.then(function (result) { .then(function (result) {
return result[0]; return result[0];