From edb2bdb5524814386ca2e346c4d01a9e9bb5250f Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Wed, 28 Jun 2023 00:13:32 -0600 Subject: [PATCH] misc.mcserver: last attempt for now --- src/modules/misc.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/modules/misc.js b/src/modules/misc.js index 7415e35..c6d0187 100644 --- a/src/modules/misc.js +++ b/src/modules/misc.js @@ -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") {