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 @@ -61,11 +61,39 @@ namespace ssu
buf++;
for (int i = 0; i < numBitfields; i++)
{
uint32_t msgID = be32toh (*(uint32_t *)buf);
buf += 4; // msgID
// TODO: process individual Ack bitfields
while (*buf & 0x80) // not last
auto it = m_SentMessages.find (msgID);
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++; // last byte
}
while (isNonLast);
}
}
uint8_t numFragments = *buf; // number of fragments

Loading…
Cancel
Save