mirror of
https://github.com/minescope/mineping.git
synced 2025-07-12 13:44:36 +03:00
fix: only perform cleanup and fire the callback on the first error
This commit is contained in:
@ -113,10 +113,9 @@ const ping = (host, port = 19132, cb, timeout = 5000) => {
|
||||
* @param {Error} err The error that occurred.
|
||||
*/
|
||||
const handleError = (err) => {
|
||||
closeSocket();
|
||||
|
||||
if (!didFireError) {
|
||||
didFireError = true;
|
||||
closeSocket();
|
||||
cb(null, err);
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user