Skip to content

Commit

Permalink
Fix ipv6 issue for ping
Browse files Browse the repository at this point in the history
  • Loading branch information
louislam committed Mar 4, 2023
1 parent 8d1847c commit 010c7d6
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions server/util-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};

Expand Down

0 comments on commit 010c7d6

Please # to comment.