// Determine how many messages were skipped accounting for 0-wraparound
int16_tlostMessages=message.seq-expectedIndex;
// Determine how many messages were skipped
intlostMessages=message.seq-expectedSeq;
// Out of order messages or wraparound can cause this, but we just ignore these conditions for simplicity
if(lostMessages<0)
if(lostMessages<0)
{
{
// Usually, this happens in the case of an out-of order packet
lostMessages=0;
lostMessages=0;
}
}
else
{
// And log how many were lost for all time and just this timestep
// Console generates excessive load at high loss rates, needs better GUI visualization
//qDebug() << QString("Lost %1 messages for comp %4: expected sequence ID %2 but received %3.").arg(lostMessages).arg(expectedIndex).arg(message.seq).arg(message.compid);
}
totalLossCounter[linkId]+=lostMessages;
totalLossCounter[linkId]+=lostMessages;
currLossCounter[linkId]+=lostMessages;
currLossCounter[linkId]+=lostMessages;
}
}
// Update the last sequence ID
// And update the last sequence number for this system/component pair