From 1c1f49aa435ce236063275df87f4492526efefe8 Mon Sep 17 00:00:00 2001 From: Cryptkeeper Date: Mon, 2 Nov 2015 01:04:49 -0600 Subject: [PATCH] Quick clean up --- app.js | 2 -- lib/logger.js | 1 + lib/ping.js | 19 ++++++++++--------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app.js b/app.js index f85509a..f0bee41 100644 --- a/app.js +++ b/app.js @@ -17,8 +17,6 @@ function pingAll() { // Handle our ping results, if it succeeded. if (err) { logger.log('error', 'Failed to ping ' + network.ip + ': ' + err); - } else { - console.log(network.ip + ': ' + res.players.online); } server.io.sockets.emit('update', res); diff --git a/lib/logger.js b/lib/logger.js index 2c616f1..389bd16 100644 --- a/lib/logger.js +++ b/lib/logger.js @@ -5,6 +5,7 @@ winston.remove(winston.transports.Console); winston.add(winston.transports.File, { filename: 'minetrack.log' }); + winston.add(winston.transports.Console, { 'timestamp': function() { var date = new Date(); diff --git a/lib/ping.js b/lib/ping.js index 8c35a53..8ff0820 100644 --- a/lib/ping.js +++ b/lib/ping.js @@ -88,6 +88,16 @@ function pingMinecraftPC(host, port, timeout, callback) { }); } +// Wraps our Buffer into another to fit the Minecraft protocol. +function writePCBuffer(client, buffer) { + var length = mcpc.createBuffer(); + + length.writeVarInt(buffer.buffer().length); + + client.write(Buffer.concat([length.buffer(), buffer.buffer()])); +} + +// This is a wrapper function for mcpe-ping, mainly used to convert the data structure of the result. function pingMinecraftPE(host, port, timeout, callback) { var milliseconds = (new Date).getTime(); @@ -108,15 +118,6 @@ function pingMinecraftPE(host, port, timeout, callback) { }, timeout); } -// Wraps our Buffer into another to fit the Minecraft protocol. -function writePCBuffer(client, buffer) { - var length = mcpc.createBuffer(); - - length.writeVarInt(buffer.buffer().length); - - client.write(Buffer.concat([length.buffer(), buffer.buffer()])); -} - exports.ping = function(host, port, type, timeout, callback) { if (type === 'PC') { pingMinecraftPC(host, port || 25565, timeout, callback);