mirror of
https://github.com/gamedig/node-gamedig.git
synced 2024-11-17 09:18:31 +01:00
Switch maxAttempts from a query param to an option Fixes #73
This commit is contained in:
parent
2cf975b9f6
commit
94815a247d
3 changed files with 6 additions and 5 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue