kopia lustrzana https://gitlab.com/eliggett/wfview
Catch excessive missing packets
rodzic
2eace96be9
commit
918238835d
|
@ -1232,6 +1232,7 @@ void udpBase::sendRetransmitRequest()
|
|||
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;
|
||||
|
@ -1241,6 +1242,18 @@ void udpBase::sendRetransmitRequest()
|
|||
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())
|
||||
{
|
||||
|
|
|
@ -1586,6 +1586,7 @@ void udpServer::sendRetransmitRequest(CLIENT* c)
|
|||
{
|
||||
if (c->missMutex.try_lock_for(std::chrono::milliseconds(LOCK_PERIOD)))
|
||||
{
|
||||
int missCounter = 0;
|
||||
auto i = std::adjacent_find(c->rxSeqBuf.keys().begin(), c->rxSeqBuf.keys().end(), [](int l, int r) {return l + 1 < r; });
|
||||
while (i != c->rxSeqBuf.keys().end())
|
||||
{
|
||||
|
@ -1606,6 +1607,17 @@ void udpServer::sendRetransmitRequest(CLIENT* c)
|
|||
return;
|
||||
}
|
||||
|
||||
missCounter++;
|
||||
|
||||
if (missCounter > 20) {
|
||||
// More than 20 packets missing, something horrific has happened!
|
||||
qDebug(logUdpServer()) << ": Too many missing packets, clearing buffer";
|
||||
c->rxSeqBuf.clear();
|
||||
c->rxMissing.clear();
|
||||
c->missMutex.unlock();
|
||||
c->rxMutex.unlock();
|
||||
return;
|
||||
}
|
||||
auto s = c->rxMissing.find(j);
|
||||
if (s == c->rxMissing.end())
|
||||
{
|
||||
|
|
Ładowanie…
Reference in New Issue