From 5fd8318efb6846cb23a4659981f462bbbdc2b19a Mon Sep 17 00:00:00 2001 From: mmorrison Date: Thu, 10 Aug 2017 06:00:33 -0500 Subject: [PATCH] Treat duplicate matching challenge keys in valve proto as non-fatal resolves #58 --- protocols/valve.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/protocols/valve.js b/protocols/valve.js index 7fd8095..dc48c2e 100644 --- a/protocols/valve.js +++ b/protocols/valve.js @@ -217,15 +217,20 @@ class Valve extends require('./core') { const type = reader.uint(1); if(type === 0x41) { - if(this.debug) console.log('Received challenge key'); - if(this._challenge) return this.fatal('Received more than one challenge key'); - this._challenge = reader.uint(4); + const key = reader.uint(4); - if(sendChallenge) { - if(this.debug) console.log('Restarting query'); - send(); - return true; + if(this.debug) console.log('Received challenge key: ' + key); + + if(this._challenge !== key) { + this._challenge = key; + if(sendChallenge) { + if (this.debug) console.log('Restarting query'); + send(); + return true; + } } + + return; } if(this.debug) console.log("Received "+type.toString(16)+" expected "+expect.toString(16));