preventing DNS lookup error from erroring the paywall detection

This commit is contained in:
tigerbot 2017-07-17 16:28:34 -06:00
parent 6ba0cac3f3
commit f3beb4795f
1 changed files with 6 additions and 1 deletions

View File

@ -79,7 +79,10 @@ module.exports.create = function (deps, conf) {
// a paywall will either manipulate DNS queries to point to the paywall gate,
// or redirect HTTP requests to the paywall gate. So we check for both and
// hope we can detect most hotel/ISP paywalls out there in the world.
//
// It is also possible that the paywall will prevent any unknown traffic from
// leaving the network, so the DNS queries could fail if the unit is set to
// use nameservers other than the paywall router.
return PromiseA.resolve()
.then(function () {
var dns = PromiseA.promisifyAll(require('dns'));
@ -90,6 +93,8 @@ module.exports.create = function (deps, conf) {
})
.then(function (result) {
return result[0];
}, function () {
return null;
});
});