diff --git a/README.md b/README.md index 3f480b0..5e386dd 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,7 @@ function(e,state) { * **host** * **port**: (optional) Uses the protocol default if not set * **notes**: (optional) Passed through to output +* **maxAttempts**: (optional) Number of attempts to query server in case of failure (default 1) ### Return Value diff --git a/games.txt b/games.txt index 6eb99fe..687b12e 100644 --- a/games.txt +++ b/games.txt @@ -166,8 +166,8 @@ mohbt|Medal of Honor: Breakthrough|gamespy1|port=12203,port_query_offset=97 moh2010|Medal of Honor 2010|battlefield|port=7673,port_query=48888 mohwf|Medal of Honor: Warfighter|battlefield|port=25200,port_query_offset=22000 -minecraft|Minecraft|gamespy3|port=25565|maxAttempts=2,srvRecord=_minecraft._tcp,doc_notes=minecraft -minecraftpe|Minecraft: Pocket Edition|gamespy3|port=19132|maxAttempts=2 +minecraft|Minecraft|gamespy3|port=25565,maxAttempts=2|srvRecord=_minecraft._tcp,doc_notes=minecraft +minecraftpe|Minecraft: Pocket Edition|gamespy3|port=19132,maxAttempts=2 minecraftping|Minecraft|minecraftping|port=25565|srvRecord=_minecraft._tcp,doc_notes=minecraft mnc|Monday Night Combat|valve|port=7777,port_query=27016 mtavc|Multi Theft Auto: Vice City|ase|port=22003,port_query_offset=123 diff --git a/protocols/core.js b/protocols/core.js index 86e5966..f64da51 100644 --- a/protocols/core.js +++ b/protocols/core.js @@ -10,9 +10,9 @@ class Core extends EventEmitter { super(); this.options = { tcpTimeout: 1000, - udpTimeout: 1000 + udpTimeout: 1000, + maxAttempts: 1 }; - this.maxAttempts = 1; this.attempt = 1; this.finished = false; this.encoding = 'utf8'; @@ -26,7 +26,7 @@ class Core extends EventEmitter { } fatal(err,noretry) { - if(!noretry && this.attempt < this.maxAttempts) { + if(!noretry && this.attempt < this.options.maxAttempts) { this.attempt++; this.start(); return;