Support dnsLookupAsync returning a string for some reason, Fixes #135

This commit is contained in:
mmorrison 2019-10-15 14:32:28 -05:00
parent 7a143002fc
commit 1b47fd2096

View file

@ -62,7 +62,15 @@ class DnsResolver {
} }
this.logger.debug("Standard Resolve: " + host); this.logger.debug("Standard Resolve: " + host);
const {address,family} = await dnsLookupAsync(host); const dnsResult = await dnsLookupAsync(host);
// For some reason, this sometimes returns a string address rather than an object.
// I haven't been able to reproduce, but it's been reported on the issue tracker.
let address;
if (typeof dnsResult === 'string') {
address = dnsResult;
} else {
address = dnsResult.address;
}
this.logger.debug("Found address: " + address); this.logger.debug("Found address: " + address);
return {address: address}; return {address: address};
} }