kopia lustrzana https://gitlab.com/eliggett/wfview
Remove unnecessary code
rodzic
2f4fe061b3
commit
bce66393fb
|
@ -1329,77 +1329,6 @@ void udpBase::sendRetransmitRequest()
|
|||
|
||||
QByteArray missingSeqs;
|
||||
|
||||
rxBufferMutex.lock();
|
||||
if (!rxSeqBuf.empty() && rxSeqBuf.size() <= rxSeqBuf.lastKey() - rxSeqBuf.firstKey())
|
||||
{
|
||||
if ((rxSeqBuf.lastKey() - rxSeqBuf.firstKey() - rxSeqBuf.size()) > 20)
|
||||
{
|
||||
// Too many packets to process, flush buffers and start again!
|
||||
qDebug(logUdp()) << "Too many missing packets, flushing buffer: " << rxSeqBuf.lastKey() << "missing=" << rxSeqBuf.lastKey() - rxSeqBuf.firstKey() - rxSeqBuf.size() + 1;
|
||||
rxMissing.clear();
|
||||
missingMutex.lock();
|
||||
rxSeqBuf.clear();
|
||||
missingMutex.unlock();
|
||||
}
|
||||
else {
|
||||
// We have at least 1 missing packet!
|
||||
qDebug(logUdp()) << "Missing Seq: size=" << rxSeqBuf.size() << "firstKey=" << rxSeqBuf.firstKey() << "lastKey=" << rxSeqBuf.lastKey() << "missing=" << rxSeqBuf.lastKey() - rxSeqBuf.firstKey() - rxSeqBuf.size() + 1;
|
||||
// We are missing packets so iterate through the buffer and add the missing ones to missing packet list
|
||||
missingMutex.lock();
|
||||
auto i = std::adjacent_find(rxSeqBuf.keys().begin(), rxSeqBuf.keys().end(), [](int l, int r) {return l + 1 < r; });
|
||||
|
||||
int missCounter = 0;
|
||||
while (i != rxSeqBuf.keys().end())
|
||||
{
|
||||
quint16 j = 1 + *i;
|
||||
++i;
|
||||
if (i == rxSeqBuf.keys().end())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
missCounter++;
|
||||
|
||||
if (missCounter > 20) {
|
||||
// More than 20 packets missing, something horrific has happened!
|
||||
qDebug(logUdp()) << this->metaObject()->className() << ": Too many missing packets, clearing buffer";
|
||||
rxSeqBuf.clear();
|
||||
rxMissing.clear();
|
||||
missingMutex.unlock();
|
||||
rxBufferMutex.unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
auto s = rxMissing.find(j);
|
||||
if (s == rxMissing.end())
|
||||
{
|
||||
// We haven't seen this missing packet before
|
||||
qDebug(logUdp()) << this->metaObject()->className() << ": Adding to missing buffer (len=" << rxMissing.size() << "): " << j;
|
||||
if (rxMissing.size() > 25)
|
||||
{
|
||||
rxMissing.erase(rxMissing.begin());
|
||||
}
|
||||
rxMissing.insert(j, 0);
|
||||
if (rxSeqBuf.size() > BUFSIZE)
|
||||
{
|
||||
rxSeqBuf.erase(rxSeqBuf.begin());
|
||||
}
|
||||
rxSeqBuf.insert(j, QTime::currentTime()); // Add this missing packet to the rxbuffer as we now long about it.
|
||||
packetsLost++;
|
||||
}
|
||||
else {
|
||||
if (s.value() == 4)
|
||||
{
|
||||
// We have tried 4 times to request this packet, time to give up!
|
||||
s = rxMissing.erase(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
missingMutex.unlock();
|
||||
}
|
||||
}
|
||||
rxBufferMutex.unlock();
|
||||
|
||||
missingMutex.lock();
|
||||
for (auto it = rxMissing.begin(); it != rxMissing.end(); ++it)
|
||||
{
|
||||
|
|
Ładowanie…
Reference in New Issue