Removed ping

This commit is contained in:
Kristjan Kirpu 2015-08-07 00:12:37 +03:00
parent 130c2e72d8
commit 5f34582804
2 changed files with 2 additions and 13 deletions

View file

@ -34,8 +34,7 @@
"request": "~2.51.0", "request": "~2.51.0",
"minimist": "~1.1.0", "minimist": "~1.1.0",
"varint": "~4.0.0", "varint": "~4.0.0",
"moment": "~2.9.0", "moment": "~2.9.0"
"jjg-ping": "~1.0.1"
}, },
"bin": { "bin": {
"gamedig": "bin/gamedig.js" "gamedig": "bin/gamedig.js"

View file

@ -3,8 +3,7 @@ var EventEmitter = require('events').EventEmitter,
net = require('net'), net = require('net'),
async = require('async'), async = require('async'),
Class = require('../lib/Class'), Class = require('../lib/Class'),
Reader = require('../lib/reader'), Reader = require('../lib/reader');
ping = require('jjg-ping');
module.exports = Class.extend(EventEmitter,{ module.exports = Class.extend(EventEmitter,{
init: function() { init: function() {
@ -19,7 +18,6 @@ module.exports = Class.extend(EventEmitter,{
this.encoding = 'utf8'; this.encoding = 'utf8';
this.byteorder = 'le'; this.byteorder = 'le';
this.delimiter = '\0'; this.delimiter = '\0';
this.ping = 0;
var self = this; var self = this;
this.globalTimeoutTimer = setTimeout(function() { this.globalTimeoutTimer = setTimeout(function() {
@ -70,7 +68,6 @@ module.exports = Class.extend(EventEmitter,{
if('port_query' in this.options) state.query.port_query = this.options.port_query; if('port_query' in this.options) state.query.port_query = this.options.port_query;
state.query.type = this.type; state.query.type = this.type;
if('pretty' in this) state.query.pretty = this.pretty; if('pretty' in this) state.query.pretty = this.pretty;
state.query.server_ping = this.ping;
this.reset(); this.reset();
this.finished = true; this.finished = true;
@ -110,13 +107,6 @@ module.exports = Class.extend(EventEmitter,{
self.parseDns(options.host,c); self.parseDns(options.host,c);
} }
}, },
function(c) {
// not sure if this is the best way to ping a host
ping.system.ping(options.host, function(latency, status) {
if(status) self.ping = latency;
});
c();
},
function(c) { function(c) {
// calculate query port if needed // calculate query port if needed
if(!('port_query' in options) && 'port' in options) { if(!('port_query' in options) && 'port' in options) {