From b3c2567043ecc207751cedeb6dde2663805af979 Mon Sep 17 00:00:00 2001 From: Fantino Davide Date: Thu, 14 Dec 2023 02:41:09 +0100 Subject: [PATCH 1/3] chore: redundant recognition of current and next layer --- squad-server/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/squad-server/index.js b/squad-server/index.js index c08c9f8..c6a12b9 100644 --- a/squad-server/index.js +++ b/squad-server/index.js @@ -527,6 +527,9 @@ export default class SquadServer extends EventEmitter { this.matchTimeout = info.matchTimeout; this.gameVersion = info.gameVersion; + if (!this.currentLayer) this.currentLayer = Layers.getLayerByClassname(info.currentLayer); + if (!this.nextLayer) this.nextLayer = Layers.getLayerByClassname(info.nextLayer); + this.emit('UPDATED_A2S_INFORMATION', info); this.emit('UPDATED_SERVER_INFORMATION', info); } catch (err) { From ff61c1a502f55a22cb005a123cbca50f73756ba8 Mon Sep 17 00:00:00 2001 From: Fantino Davide Date: Thu, 14 Dec 2023 02:43:04 +0100 Subject: [PATCH 2/3] fix: increased maximum buffer size --- core/rcon.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/rcon.js b/core/rcon.js index 1fe0bb0..e06b9c2 100644 --- a/core/rcon.js +++ b/core/rcon.js @@ -186,7 +186,7 @@ export default class Rcon extends EventEmitter { return this.soh; } const bufSize = this.stream.readInt32LE(0); - if (bufSize > 4154 || bufSize < 10) return this.badPacket(); + if (bufSize > 8192 || bufSize < 10) return this.badPacket(); else if (bufSize <= this.stream.byteLength - 4 && this.stream.byteLength >= 12) { const bufId = this.stream.readInt32LE(4); const bufType = this.stream.readInt32LE(8); From 1f6e61288a1ed4c81aa6fdc5b99ebedccefb79e7 Mon Sep 17 00:00:00 2001 From: Fantino Davide Date: Thu, 14 Dec 2023 03:08:14 +0100 Subject: [PATCH 3/3] fix: typos as suggested in https://github.com/Team-Silver-Sphere/SquadJS/pull/318#issuecomment-1854740474 --- core/rcon.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/rcon.js b/core/rcon.js index e06b9c2..1cbe73a 100644 --- a/core/rcon.js +++ b/core/rcon.js @@ -228,7 +228,7 @@ export default class Rcon extends EventEmitter { this.emit(`response${this.responseString.id - 2}`, this.responseString.body); this.responseString.body = ''; } else if (!packet.body.includes('')) { - this.responseString.body = this.responseString.body += packet.body; + this.responseString.body = this.responseString.body + packet.body; this.responseString.id = packet.id; } else this.badPacket(); } @@ -241,7 +241,7 @@ export default class Rcon extends EventEmitter { }` ); this.stream = Buffer.alloc(0); - this.responseString = ''; + this.responseString.body = ''; return null; } onClose() {