diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e4cd4e..ea0118c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,7 +36,8 @@ * `stripColors` (defaults to `true`) for protocols that strips colors: unreal2, savage2, quake3, nadeo, gamespy2, doom3, armagetron. * `requestRulesRequired` (defaults to `false`) Valve games only. `requestRules` is always required to have a response or the query will timeout. * `requestPlayersRequired` (defaults to `false`) Valve games only. Querying players is always required to have a response or the query will timeout. Some [games](GAMES_LIST.md) may not provide a players response. - * `address` (defaults to `undefined`) Override the IP address of the server skipping DNS resolution. When set, host will not be resolved, instead address will be connected to. However, some protocols still use host for other reasons e.g. as part of the query. +* Now documented: `address` (defaults to `undefined`) Override the IP address of the server skipping DNS resolution. When set, host will not be resolved, instead address will be connected to. However, some protocols still use host for other reasons e.g. as part of the query. +* `maxAttempts` has been renamed to `maxRetries`. #### Games * Removed the players::setNum method, the library will no longer add empty players as diff --git a/README.md b/README.md index f80b054..29442b1 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ Confused on how this works, or you want to see more? Checkout the [examples](/ex |:---------------------------|:--------|:----------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | **address** | string | undefined | Override the IP address of the server skipping DNS resolution. When set, host will not be resolved, instead address will be connected to. However, some protocols still use host for other reasons e.g. as part of the query. | | **port** | number | Game port | Connection port or query port for the game server. Some games utilize a separate "query" port. If specifying the game port does not seem to work as expected, passing in this query port may work instead. | -| **maxAttempts** | number | 1 | Number of attempts to query server in case of failure. | +| **maxRetries** | number | 1 | Number of retries to query server in case of failure. Note that this amount multiplies with the number of attempts. | | **socketTimeout** | number | 2000 | Milliseconds to wait for a single packet. Beware that increasing this will cause many queries to take longer even if the server is online. | | **attemptTimeout** | number | 10000 | Milliseconds allowed for an entire query attempt. This timeout is not commonly hit, as the socketTimeout typically fires first. | | **givenPortOnly** | boolean | false | Only attempt to query server on given port. It will ignore the game's default port. | diff --git a/lib/QueryRunner.js b/lib/QueryRunner.js index 7f0eb45..6c12f31 100644 --- a/lib/QueryRunner.js +++ b/lib/QueryRunner.js @@ -5,7 +5,7 @@ import GlobalUdpSocket from './GlobalUdpSocket.js' const defaultOptions = { socketTimeout: 2000, attemptTimeout: 10000, - maxAttempts: 1, + maxRetries: 1, stripColors: true, portCache: true, ipFamily: 0 @@ -74,7 +74,7 @@ export default class QueryRunner { attempts.push(optionsCollection) } - const numRetries = userOptions.maxAttempts || gameOptions.maxAttempts || defaultOptions.maxAttempts + const numRetries = userOptions.maxRetries || gameOptions.maxRetries || defaultOptions.maxRetries let attemptNum = 0 const errors = []