more debugging
This commit is contained in:
parent
c72b2c494e
commit
59d2db1785
|
@ -54,11 +54,13 @@ export class Server {
|
||||||
const packetId = socket.data.dataBuffer.readUint8(0);
|
const packetId = socket.data.dataBuffer.readUint8(0);
|
||||||
const packetLength = this.lengthMap.get(packetId);
|
const packetLength = this.lengthMap.get(packetId);
|
||||||
if(!packetLength) {
|
if(!packetLength) {
|
||||||
|
log.debug("Incorrect packet ID", packetId, "packet length could not be found.")
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
if(socket.data.dataBuffer.byteLength < packetLength) return;
|
if(socket.data.dataBuffer.byteLength < packetLength) return;
|
||||||
|
|
||||||
this.handlePacket(socket.data.dataBuffer.copyWithin(0, 1), packetId, socket);
|
this.handlePacket(socket.data.dataBuffer.subarray(1), packetId, socket);
|
||||||
|
log.debug("Parsed packet", packetId, "with packet length", packetLength)
|
||||||
socket.data.dataBuffer = socket.data.dataBuffer.subarray(packetLength+1);
|
socket.data.dataBuffer = socket.data.dataBuffer.subarray(packetLength+1);
|
||||||
parseBuffer();
|
parseBuffer();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue