made mDNS query for paywall check more error resistant
This commit is contained in:
parent
95d5526f28
commit
6ba0cac3f3
|
@ -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];
|
||||||
|
|
Loading…
Reference in New Issue