mirror of
https://github.com/gamedig/node-gamedig.git
synced 2024-11-17 09:18:31 +01:00
Add warning when connection port is unknown.
This commit is contained in:
parent
d8f8d0f648
commit
1cafb4eb86
2 changed files with 15 additions and 0 deletions
|
@ -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) {
|
||||||
|
|
14
lib/index.js
14
lib/index.js
|
@ -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];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue