1
This commit is contained in:
parent
afe2c8d890
commit
2eccca1186
@ -94,11 +94,12 @@ class ClientNet {
|
|||||||
|
|
||||||
async onParsePacket() {
|
async onParsePacket() {
|
||||||
let offset = 0;
|
let offset = 0;
|
||||||
while (this.recvBuf.length > offset + 12) {
|
while (this.recvBuf.length >= offset + 12) {
|
||||||
const msgSize = this.recvBuf.readUInt16LE(offset + 0);
|
const msgSize = this.recvBuf.readUInt16LE(offset + 0);
|
||||||
const msgId = this.recvBuf.readUInt16LE(offset + 2);
|
const msgId = this.recvBuf.readUInt16LE(offset + 2);
|
||||||
const seqId = this.recvBuf.readUInt32LE(offset + 4);
|
const seqId = this.recvBuf.readUInt32LE(offset + 4);
|
||||||
const magicCode = this.recvBuf.readUInt16LE(offset + 8);
|
const magicCode = this.recvBuf.readUInt16LE(offset + 8);
|
||||||
|
//console.log('onParsePacket', msgSize, msgId, seqId, magicCode);
|
||||||
if (this.recvBuf.length >= offset + 12 + msgSize) {
|
if (this.recvBuf.length >= offset + 12 + msgSize) {
|
||||||
await this.processMsg(msgId,
|
await this.processMsg(msgId,
|
||||||
this.recvBuf.slice
|
this.recvBuf.slice
|
||||||
|
Loading…
x
Reference in New Issue
Block a user