From 87c0850c5b89c665b0c92b28c627bdca23dbb505 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Fri, 8 Apr 2022 18:42:37 +0100 Subject: [PATCH] Fixed retransmit bug in server code. --- udpserver.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/udpserver.cpp b/udpserver.cpp index 56fee68..9c3fd7d 100644 --- a/udpserver.cpp +++ b/udpserver.cpp @@ -908,20 +908,21 @@ void udpServer::commonReceived(QList* l, CLIENT* current, QByteArray r) if (current->missMutex.try_lock_for(std::chrono::milliseconds(LOCK_PERIOD))) { - for (quint16 f = current->rxSeqBuf.lastKey() + 1; f < in->seq; f++) + for (quint16 f = current->rxSeqBuf.lastKey() + 1; f <= in->seq; f++) { - qInfo(logUdpServer()) << "Detected missing packet" << f; - if (current->rxSeqBuf.size() > BUFSIZE) { current->rxSeqBuf.remove(current->rxSeqBuf.firstKey()); } current->rxSeqBuf.insert(f, QTime::currentTime()); - if (!current->rxMissing.contains(f)) - { - current->rxMissing.insert(f, 0); + if (f != in->seq) { + qInfo(logUdpServer()) << "Detected missing packet" << f; + if (!current->rxMissing.contains(f)) + { + current->rxMissing.insert(f, 0); + } } } current->missMutex.unlock();