Switch maxAttempts from a query param to an option Fixes #73
This commit is contained in:
parent
2cf975b9f6
commit
94815a247d
|
@ -51,6 +51,7 @@ function(e,state) {
|
||||||
* **host**
|
* **host**
|
||||||
* **port**: (optional) Uses the protocol default if not set
|
* **port**: (optional) Uses the protocol default if not set
|
||||||
* **notes**: (optional) Passed through to output
|
* **notes**: (optional) Passed through to output
|
||||||
|
* **maxAttempts**: (optional) Number of attempts to query server in case of failure (default 1)
|
||||||
|
|
||||||
### Return Value
|
### 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
|
moh2010|Medal of Honor 2010|battlefield|port=7673,port_query=48888
|
||||||
mohwf|Medal of Honor: Warfighter|battlefield|port=25200,port_query_offset=22000
|
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
|
minecraft|Minecraft|gamespy3|port=25565,maxAttempts=2|srvRecord=_minecraft._tcp,doc_notes=minecraft
|
||||||
minecraftpe|Minecraft: Pocket Edition|gamespy3|port=19132|maxAttempts=2
|
minecraftpe|Minecraft: Pocket Edition|gamespy3|port=19132,maxAttempts=2
|
||||||
minecraftping|Minecraft|minecraftping|port=25565|srvRecord=_minecraft._tcp,doc_notes=minecraft
|
minecraftping|Minecraft|minecraftping|port=25565|srvRecord=_minecraft._tcp,doc_notes=minecraft
|
||||||
mnc|Monday Night Combat|valve|port=7777,port_query=27016
|
mnc|Monday Night Combat|valve|port=7777,port_query=27016
|
||||||
mtavc|Multi Theft Auto: Vice City|ase|port=22003,port_query_offset=123
|
mtavc|Multi Theft Auto: Vice City|ase|port=22003,port_query_offset=123
|
||||||
|
|
|
@ -10,9 +10,9 @@ class Core extends EventEmitter {
|
||||||
super();
|
super();
|
||||||
this.options = {
|
this.options = {
|
||||||
tcpTimeout: 1000,
|
tcpTimeout: 1000,
|
||||||
udpTimeout: 1000
|
udpTimeout: 1000,
|
||||||
|
maxAttempts: 1
|
||||||
};
|
};
|
||||||
this.maxAttempts = 1;
|
|
||||||
this.attempt = 1;
|
this.attempt = 1;
|
||||||
this.finished = false;
|
this.finished = false;
|
||||||
this.encoding = 'utf8';
|
this.encoding = 'utf8';
|
||||||
|
@ -26,7 +26,7 @@ class Core extends EventEmitter {
|
||||||
}
|
}
|
||||||
|
|
||||||
fatal(err,noretry) {
|
fatal(err,noretry) {
|
||||||
if(!noretry && this.attempt < this.maxAttempts) {
|
if(!noretry && this.attempt < this.options.maxAttempts) {
|
||||||
this.attempt++;
|
this.attempt++;
|
||||||
this.start();
|
this.start();
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue