From 81a3ec10193fd3f5752689a226c51d8d29dbab25 Mon Sep 17 00:00:00 2001 From: Michael Morrison Date: Wed, 2 Sep 2020 05:58:35 -0500 Subject: [PATCH] Always treat missing valve player response as non-fatal (2.0.23) --- CHANGELOG.md | 4 ++++ package.json | 2 +- protocols/valve.js | 22 ++++++++++++---------- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 40f71b8..fc5aa5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +### 2.0.23 +* Fix Conan Exiles and other games which don't respond to the valve player query +* Add givenPortOnly query option for users that require extreme optimization + ### 2.0.22 * Updated dependencies diff --git a/package.json b/package.json index 7391083..25fc7dc 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ ], "main": "lib/index.js", "author": "GameDig Contributors", - "version": "2.0.22", + "version": "2.0.23", "repository": { "type": "git", "url": "https://github.com/gamedig/node-gamedig.git" diff --git a/protocols/valve.js b/protocols/valve.js index d78ebfc..56cf53c 100644 --- a/protocols/valve.js +++ b/protocols/valve.js @@ -113,10 +113,9 @@ class Valve extends Core { ) { this._skipSizeInSplitHeader = true; } - this.debugLog("STEAM APPID: "+state.raw.steamappid); - this.debugLog("PROTOCOL: "+state.raw.protocol); + this.logger.debug("INFO: ", state.raw); if(state.raw.protocol === 48) { - this.debugLog("GOLDSRC DETECTED - USING MODIFIED SPLIT FORMAT"); + this.logger.debug("GOLDSRC DETECTED - USING MODIFIED SPLIT FORMAT"); this.goldsrcSplits = true; } } @@ -139,19 +138,22 @@ class Valve extends Core { async queryPlayers(state) { state.raw.players = []; - // CSGO doesn't even respond sometimes if host_players_show is not 2 - // Ignore timeouts in only this case - const allowTimeout = state.raw.steamappid === 730; - this.debugLog("Requesting player list ..."); const b = await this.sendPacket( 0x55, true, null, 0x44, - allowTimeout + true ); - if (b === null) return; // timed out + + if (b === null) { + // Player query timed out + // CSGO doesn't respond to player query if host_players_show is not 2 + // Conan Exiles never responds to player query + // Just skip it, and we'll fill with dummy objects in cleanup() + return; + } const reader = this.reader(b); const num = reader.uint(1); @@ -179,7 +181,7 @@ class Valve extends Core { state.raw.rules = {}; this.debugLog("Requesting rules ..."); const b = await this.sendPacket(0x56,true,null,0x45,true); - if (b === null) return; // timed out - the server probably just has rules disabled + if (b === null) return; // timed out - the server probably has rules disabled const reader = this.reader(b); const num = reader.uint(2);