Fix WARNING related to appended acks in non-zerocoded packets

This commit is contained in:
Casper Warden
2017-12-19 23:36:28 +00:00
parent 58b29d8893
commit 4743dbfeec
3 changed files with 8 additions and 3 deletions

View File

@@ -96,6 +96,10 @@ export class Packet
this.extraHeader = Buffer.allocUnsafe(0);
}
let appendedAcks = 0;
if (this.packetFlags & PacketFlags.Ack)
{
appendedAcks = buf.readUInt8(buf.length - 1);
}
if (this.packetFlags & PacketFlags.Zerocoded)
{
// Annoyingly, the AppendedAcks aren't zerocoded so we need to stop decode early
@@ -104,7 +108,6 @@ export class Packet
{
// Final byte in the packet contains the number of Acks
tail = 1;
appendedAcks = buf.readUInt8(buf.length - 1);
if (appendedAcks > 0)
{
tail += appendedAcks * 4;