Drop the try catches, this might make it a bit unstable until we work out some bugs.
This commit is contained in:
parent
0150e3b30e
commit
82752767b9
10
lib/ping.js
10
lib/ping.js
@ -7,8 +7,6 @@ var util = require('./util');
|
|||||||
function pingMinecraftPC(host, port, timeout, callback) {
|
function pingMinecraftPC(host, port, timeout, callback) {
|
||||||
var startTime = util.getCurrentTimeMs();
|
var startTime = util.getCurrentTimeMs();
|
||||||
|
|
||||||
// Try catch incase the down stream module is bad at handling exceptions.
|
|
||||||
try {
|
|
||||||
mcpc_ping(host, port, function(err, res) {
|
mcpc_ping(host, port, function(err, res) {
|
||||||
if (err) {
|
if (err) {
|
||||||
callback(err, null);
|
callback(err, null);
|
||||||
@ -25,17 +23,12 @@ function pingMinecraftPC(host, port, timeout, callback) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, timeout);
|
}, timeout);
|
||||||
} catch (err) {
|
|
||||||
callback(err, null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is a wrapper function for mcpe-ping, mainly used to convert the data structure of the result.
|
// This is a wrapper function for mcpe-ping, mainly used to convert the data structure of the result.
|
||||||
function pingMinecraftPE(host, port, timeout, callback) {
|
function pingMinecraftPE(host, port, timeout, callback) {
|
||||||
var startTime = util.getCurrentTimeMs();
|
var startTime = util.getCurrentTimeMs();
|
||||||
|
|
||||||
// Try catch incase the down stream module is bad at handling exceptions.
|
|
||||||
try {
|
|
||||||
mcpe_ping(host, port || 19132, function(err, res) {
|
mcpe_ping(host, port || 19132, function(err, res) {
|
||||||
if (err) {
|
if (err) {
|
||||||
callback(err, null);
|
callback(err, null);
|
||||||
@ -51,9 +44,6 @@ function pingMinecraftPE(host, port, timeout, callback) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, timeout);
|
}, timeout);
|
||||||
} catch (err) {
|
|
||||||
callback(err, null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.ping = function(host, port, type, timeout, callback) {
|
exports.ping = function(host, port, type, timeout, callback) {
|
||||||
|
Loading…
Reference in New Issue
Block a user