misc.mcserver: last attempt for now
This commit is contained in:
parent
e8dbdb94a1
commit
edb2bdb552
1 changed files with 12 additions and 9 deletions
|
@ -765,15 +765,17 @@ mcserver.callback = async function (msg, line) {
|
||||||
resolve("timeout");
|
resolve("timeout");
|
||||||
}, 10000);
|
}, 10000);
|
||||||
|
|
||||||
const client = net.createConnection({
|
const client = net.createConnection(
|
||||||
host: ip,
|
{
|
||||||
port: port,
|
host: ip,
|
||||||
timeout: 10000,
|
port: port,
|
||||||
});
|
timeout: 10000,
|
||||||
client.on("connect", function () {
|
},
|
||||||
logger.verbose("mcserver", "connect");
|
function () {
|
||||||
client.write(HANDSHAKE_PACKET);
|
logger.verbose("mcserver", "connect");
|
||||||
});
|
client.write(HANDSHAKE_PACKET);
|
||||||
|
}
|
||||||
|
);
|
||||||
let totalData = Buffer.alloc(0);
|
let totalData = Buffer.alloc(0);
|
||||||
client.on("data", function (data) {
|
client.on("data", function (data) {
|
||||||
totalData = Buffer.concat([totalData, data]);
|
totalData = Buffer.concat([totalData, data]);
|
||||||
|
@ -797,6 +799,7 @@ mcserver.callback = async function (msg, line) {
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
return resolve(json);
|
return resolve(json);
|
||||||
});
|
});
|
||||||
|
client.on("timeout", function () {});
|
||||||
});
|
});
|
||||||
|
|
||||||
if (data == "timeout") {
|
if (data == "timeout") {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue