From 2eccca118684c83196ec82f5036cdedd92fe3628 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Sun, 24 Sep 2023 11:37:52 +0800 Subject: [PATCH] 1 --- tools/robot/clientnet.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/robot/clientnet.js b/tools/robot/clientnet.js index 02300a25..ed1e1d16 100644 --- a/tools/robot/clientnet.js +++ b/tools/robot/clientnet.js @@ -94,11 +94,12 @@ class ClientNet { async onParsePacket() { let offset = 0; - while (this.recvBuf.length > offset + 12) { + while (this.recvBuf.length >= offset + 12) { const msgSize = this.recvBuf.readUInt16LE(offset + 0); const msgId = this.recvBuf.readUInt16LE(offset + 2); const seqId = this.recvBuf.readUInt32LE(offset + 4); const magicCode = this.recvBuf.readUInt16LE(offset + 8); + //console.log('onParsePacket', msgSize, msgId, seqId, magicCode); if (this.recvBuf.length >= offset + 12 + msgSize) { await this.processMsg(msgId, this.recvBuf.slice