Compare commits

...

2 Commits

Author SHA1 Message Date
Timofey Gelazoniya 7cd3444a4f
Merge pull request #1 from romanalexander/fixes/bedrock-ping
Fix ping never firing an error when timeout occurs.
2023-10-09 02:21:00 +03:00
Roman Alexander af78a184db
Fix ping never firing an error when timeout occurs. 2023-10-08 16:22:18 -04:00
1 changed files with 4 additions and 4 deletions

View File

@ -132,7 +132,7 @@ function ping(host, port = 19132, cb, timeout = 5000) {
// Close the socket and clear the timeout task
// This is a general cleanup for success conditions
closeSocket();
cb(null, clientData);
cb(clientData, null);
break;
}
@ -160,9 +160,9 @@ export function pingBedrock(host, options = {}) {
const { port = 19132, timeout = 5000 } = options;
return new Promise((resilve, reject) => {
ping(host, port, (err, res) => {
err ? reject(err) : resilve(res);
return new Promise((resolve, reject) => {
ping(host, port, (res, err) => {
err ? reject(err) : resolve(res);
}, timeout);
});
}