Add warning when connection port is unknown.

This commit is contained in:
Michael Morrison 2014-02-03 16:38:10 -06:00
parent d8f8d0f648
commit 1cafb4eb86
2 changed files with 15 additions and 0 deletions

View file

@ -21,6 +21,7 @@ for(var key in argv) {
var Gamedig = require('../lib/index'); var Gamedig = require('../lib/index');
if(debug) Gamedig.debug = true; if(debug) Gamedig.debug = true;
Gamedig.isCommandLine = true;
Gamedig.query( Gamedig.query(
options, options,
function(state) { function(state) {

View file

@ -44,6 +44,20 @@ Gamedig = {
query.udpSocket = udpSocket; query.udpSocket = udpSocket;
query.type = options.type; query.type = options.type;
if(!('port' in query.options) && ('port_query' in query.options)) {
if(Gamedig.isCommandLine) {
process.stderr.write(
"Warning! This game is so old, that we don't know"
+" what the server's connection port is. We've guessed that"
+" the query port for "+query.type+" is "+query.options.port_query+"."
+" If you know the connection port for this type of server, please let"
+" us know on the GameDig issue tracker, thanks!\n"
);
}
query.options.port = query.options.port_query;
delete query.options.port_query;
}
// copy over options // copy over options
for(var i in options) query.options[i] = options[i]; for(var i in options) query.options[i] = options[i];