From 3568c80fcc695a0cfeba22a9c68190b4df03ed84 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Thu, 27 Jan 2022 23:28:34 +0000 Subject: [PATCH] Fix mutex --- udphandler.cpp | 7 ++++--- udpserver.cpp | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/udphandler.cpp b/udphandler.cpp index 596afc3..f4156f2 100644 --- a/udphandler.cpp +++ b/udphandler.cpp @@ -1325,11 +1325,12 @@ void udpBase::sendRetransmitRequest() else if (rxMissing.size() > 100) { qDebug(logUdp()) << "Too many missing packets," << rxMissing.size() << "flushing all buffers"; missingMutex.lock(); - rxBufferMutex.lock(); - qDebug(logUdp()) << "Too many missing packets, full reset!"; - rxSeqBuf.clear(); rxMissing.clear(); missingMutex.unlock(); + + rxBufferMutex.lock(); + rxSeqBuf.clear(); + rxBufferMutex.unlock(); return; } diff --git a/udpserver.cpp b/udpserver.cpp index a922367..d1059dd 100644 --- a/udpserver.cpp +++ b/udpserver.cpp @@ -1690,10 +1690,10 @@ void udpServer::sendRetransmitRequest(CLIENT* c) } else if (c->rxMissing.size() > 100) { qDebug(logUdp()) << "Too many missing packets," << c->rxMissing.size() << "flushing all buffers"; - c->missMutex.lock(); c->rxMutex.lock(); - qDebug(logUdp()) << "Too many missing packets, full reset!"; c->rxSeqBuf.clear(); + c->rxMutex.unlock(); + c->missMutex.lock(); c->rxMissing.clear(); c->missMutex.unlock(); return;