Browse Source

handle individaul bitfields ack

pull/93/head
orignal 10 years ago
parent
commit
275155998f
  1. 34
      SSUData.cpp

34
SSUData.cpp

@ -61,11 +61,39 @@ namespace ssu
buf++; buf++;
for (int i = 0; i < numBitfields; i++) for (int i = 0; i < numBitfields; i++)
{ {
uint32_t msgID = be32toh (*(uint32_t *)buf);
buf += 4; // msgID buf += 4; // msgID
// TODO: process individual Ack bitfields auto it = m_SentMessages.find (msgID);
while (*buf & 0x80) // not last int numSentFragments = it->second.size ();
// process individual Ack bitfields
bool isNonLast = false;
int fragment = 0;
do
{
uint8_t bitfield = *buf;
isNonLast = bitfield & 0x80;
bitfield &= 0x7F; // clear MSB
if (bitfield && it != m_SentMessages.end ())
{
// process bits
uint8_t mask = 0x40;
for (int j = 0; j < 7; j++)
{
if (bitfield & mask)
{
if (fragment < numSentFragments)
{
delete it->second[fragment];
it->second[fragment] = nullptr;
}
}
fragment++;
mask >>= 1;
}
}
buf++; buf++;
buf++; // last byte }
while (isNonLast);
} }
} }
uint8_t numFragments = *buf; // number of fragments uint8_t numFragments = *buf; // number of fragments

Loading…
Cancel
Save