From 0aaf5de9764bbd71d8ee51a321a9c1ace7951003 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Fri, 8 Apr 2022 11:22:33 +0100 Subject: [PATCH] Hopefully fix silly retransmit bug --- udphandler.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/udphandler.cpp b/udphandler.cpp index 812b44c..2854ca9 100644 --- a/udphandler.cpp +++ b/udphandler.cpp @@ -1269,18 +1269,19 @@ void udpBase::dataReceived(QByteArray r) // Add incoming packet to the received buffer and if it is in the missing buffer, remove it. if (in->seq > rxSeqBuf.lastKey() + 1) { + qInfo(logUdp()) << this->metaObject()->className() << "1 or more missing packets detected, previous: " << hex << rxSeqBuf.lastKey() << " current: " << hex << in->seq; // We are likely missing packets then! missingMutex.lock(); //int missCounter = 0; // Sanity check! - for (quint16 f = rxSeqBuf.lastKey() + 1; f < in->seq; f++) + for (quint16 f = rxSeqBuf.lastKey() + 1; f <= in->seq; f++) { if (rxSeqBuf.size() > BUFSIZE) { rxSeqBuf.erase(rxSeqBuf.begin()); } rxSeqBuf.insert(f, QTime::currentTime()); - if (!rxMissing.contains(f)) + if (f != in->seq && !rxMissing.contains(f)) { rxMissing.insert(f, 0); }