From 69d4f6af3ca0a4a779e03b1a0a3e1183767db493 Mon Sep 17 00:00:00 2001 From: draco2003 Date: Sat, 2 Mar 2013 04:52:28 +0000 Subject: [PATCH] only split the packet if we need to --- stats.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/stats.js b/stats.js index d1e7b8f..738e5da 100644 --- a/stats.js +++ b/stats.js @@ -141,7 +141,12 @@ config.configFile(process.argv[2], function (config, oldConfig) { server = dgram.createSocket('udp4', function (msg, rinfo) { backendEvents.emit('packet', msg, rinfo); counters[packets_received]++; - var metrics = msg.toString().split("\n"); + var packet_data = msg.toString(); + if (packet_data.indexOf("\n") > -1) { + var metrics = packet_data.split("\n"); + } else { + var metrics = [ packet_data ] ; + } for (var midx in metrics) { if (config.dumpMessages) {