misc.mcserver: last attempt for now

This commit is contained in:
Cynthia Foxwell 2023-06-28 00:13:32 -06:00
parent e8dbdb94a1
commit edb2bdb552
1 changed files with 12 additions and 9 deletions

View File

@ -765,15 +765,17 @@ mcserver.callback = async function (msg, line) {
resolve("timeout");
}, 10000);
const client = net.createConnection({
host: ip,
port: port,
timeout: 10000,
});
client.on("connect", function () {
logger.verbose("mcserver", "connect");
client.write(HANDSHAKE_PACKET);
});
const client = net.createConnection(
{
host: ip,
port: port,
timeout: 10000,
},
function () {
logger.verbose("mcserver", "connect");
client.write(HANDSHAKE_PACKET);
}
);
let totalData = Buffer.alloc(0);
client.on("data", function (data) {
totalData = Buffer.concat([totalData, data]);
@ -797,6 +799,7 @@ mcserver.callback = async function (msg, line) {
clearTimeout(timeout);
return resolve(json);
});
client.on("timeout", function () {});
});
if (data == "timeout") {