Fix ipv6 issue for ping

pull/2788/head
Louis Lam 1 year ago
parent 8d1847c032
commit 010c7d681f

@ -87,11 +87,8 @@ exports.ping = async (hostname, size = 56) => {
return await exports.pingAsync(hostname, false, size);
} catch (e) {
// If the host cannot be resolved, try again with ipv6
if (e.message.includes("service not known")) {
return await exports.pingAsync(hostname, true, size);
} else {
throw e;
}
// As node-ping does not report a specific error for this, try again with ipv6 no matter what.
return await exports.pingAsync(hostname, true, size);
}
};

Loading…
Cancel
Save