From 8e97a5095764ba40aa1f4ff51b9a8a3015a44fb5 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 21 Mar 2016 11:56:36 -0700 Subject: [PATCH] unlock before de-activating the queue --- libraries/networking/src/udt/SendQueue.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libraries/networking/src/udt/SendQueue.cpp b/libraries/networking/src/udt/SendQueue.cpp index 06e82d439c..87f2f0a5bc 100644 --- a/libraries/networking/src/udt/SendQueue.cpp +++ b/libraries/networking/src/udt/SendQueue.cpp @@ -482,9 +482,6 @@ bool SendQueue::isInactive(bool sentAPacket) { // use our condition_variable_any to wait auto cvStatus = _emptyCondition.wait_for(locker, EMPTY_QUEUES_INACTIVE_TIMEOUT); - // we have the lock again - Make sure to unlock it - locker.unlock(); - if (cvStatus == std::cv_status::timeout && (_packets.isEmpty() || isFlowWindowFull()) && _naks.isEmpty()) { #ifdef UDT_CONNECTION_DEBUG qCDebug(networking) << "SendQueue to" << _destination << "has been empty for" @@ -492,11 +489,15 @@ bool SendQueue::isInactive(bool sentAPacket) { << "seconds and receiver has ACKed all packets." << "The queue is now inactive and will be stopped."; #endif + + // we have the lock again - Make sure to unlock it + locker.unlock(); // Deactivate queue deactivate(); return true; } + } else { // We think the client is still waiting for data (based on the sequence number gap) // Let's wait either for a response from the client or until the estimated timeout