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") {