1 byte off for ranges in Ack block

This commit is contained in:
orignal 2022-06-14 13:02:39 -04:00
parent 03518ec94f
commit 0c64f278d7

View File

@ -1638,7 +1638,7 @@ namespace transport
{ {
if (lastNum - (*it) < 255) if (lastNum - (*it) < 255)
{ {
buf[7 + numRanges*2] = lastNum - (*it) - 1; // NACKs buf[8 + numRanges*2] = lastNum - (*it) - 1; // NACKs
lastNum = *it; it++; lastNum = *it; it++;
uint8_t numAcks = 1; uint8_t numAcks = 1;
while (it != m_OutOfSequencePackets.rend () && numAcks < 255 && lastNum > 0 && *it == lastNum - 1) while (it != m_OutOfSequencePackets.rend () && numAcks < 255 && lastNum > 0 && *it == lastNum - 1)
@ -1646,7 +1646,7 @@ namespace transport
numAcks++; lastNum--; numAcks++; lastNum--;
it++; it++;
} }
buf[7 + numRanges*2 + 1] = numAcks; // Acks buf[8 + numRanges*2 + 1] = numAcks; // Acks
numRanges++; numRanges++;
if (numAcks == 255) break; if (numAcks == 255) break;
} }
@ -1660,8 +1660,8 @@ namespace transport
if (nacks > 0) if (nacks > 0)
{ {
if (nacks > 255) nacks = 255; if (nacks > 255) nacks = 255;
buf[7 + numRanges*2] = nacks; buf[8 + numRanges*2] = nacks;
buf[7 + numRanges*2 + 1] = std::min ((int)m_ReceivePacketNum, 255); buf[8 + numRanges*2 + 1] = std::min ((int)m_ReceivePacketNum + 1, 255);
numRanges++; numRanges++;
} }
} }