This commit is contained in:
LouisLam 2021-08-10 22:00:29 +08:00
parent e0ae9a9e73
commit d5149f90b4
3 changed files with 5 additions and 9 deletions

View file

@ -47,11 +47,11 @@ exports.tcping = function (hostname, port) {
exports.ping = async (hostname) => {
try {
await exports.pingAsync(hostname);
return await exports.pingAsync(hostname);
} catch (e) {
// If the host cannot be resolved, try again with ipv6
if (e.message.includes("service not known")) {
await exports.pingAsync(hostname, true);
return await exports.pingAsync(hostname, true);
} else {
throw e;
}