Attempt to fix weird retransmission bug

merge-requests/9/merge
Phil Taylor 2022-04-08 09:53:02 +01:00
rodzic 2ca376a3c1
commit 23b37f2754
2 zmienionych plików z 10 dodań i 5 usunięć

Wyświetl plik

@ -15,7 +15,7 @@
#define LOCK_PERIOD 10 // How long to try to lock mutex (ms)
#define STALE_CONNECTION 15 // Not heard from in this many seconds
#define BUFSIZE 500 // Number of packets to buffer
#define MAX_MISSING 50 // Make the maximum number of possible missing packets much less than total buffer size!
#define MAX_MISSING 50 // More than this indicates serious network problem
#define AUDIO_PERIOD 20
#define GUIDLEN 16

Wyświetl plik

@ -1246,17 +1246,21 @@ void udpBase::dataReceived(QByteArray r)
rxSeqBuf.erase(rxSeqBuf.begin());
}
rxSeqBuf.insert(in->seq, QTime::currentTime());
}
}
else
{
if (in->seq < rxSeqBuf.firstKey())
if (in->seq < rxSeqBuf.firstKey() || in->seq - rxSeqBuf.lastKey() > MAX_MISSING)
{
qInfo(logUdp()) << this->metaObject()->className() << ": ******* seq number has rolled over ****** previous highest: " << hex << rxSeqBuf.lastKey() << " current: " << hex << in->seq;
qInfo(logUdp()) << this->metaObject()->className() << "Large seq number gap detected, previous highest: " << hex << rxSeqBuf.lastKey() << " current: " << hex << in->seq;
//seqPrefix++;
// Looks like it has rolled over so clear buffer and start again.
rxSeqBuf.clear();
rxMissing.clear();
// Add this packet to the incoming buffer
rxSeqBuf.insert(in->seq, QTime::currentTime());
rxBufferMutex.unlock();
missingMutex.lock();
rxMissing.clear();
missingMutex.unlock();
return;
}
@ -1268,6 +1272,7 @@ void udpBase::dataReceived(QByteArray r)
// We are likely missing packets then!
missingMutex.lock();
//int missCounter = 0;
// Sanity check!
for (quint16 f = rxSeqBuf.lastKey() + 1; f < in->seq; f++)
{
if (rxSeqBuf.size() > BUFSIZE)