From b7ff94e20d9eeb781ab644e58b415cac194d067b Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 21 Mar 2016 10:09:28 -0700 Subject: [PATCH] put packets back in the queue if flow window is full --- libraries/networking/src/udt/SendQueue.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libraries/networking/src/udt/SendQueue.cpp b/libraries/networking/src/udt/SendQueue.cpp index 90f6cf9813..6bace3ba21 100644 --- a/libraries/networking/src/udt/SendQueue.cpp +++ b/libraries/networking/src/udt/SendQueue.cpp @@ -314,7 +314,6 @@ bool SendQueue::maybeSendNewPacket() { if (seqlen(SequenceNumber { (uint32_t) _lastACKSequenceNumber }, _currentSequenceNumber) <= _flowWindowSize) { // we didn't re-send a packet, so time to send a new one - if (!_packets.isEmpty()) { SequenceNumber nextNumber = getNextSequenceNumber(); @@ -467,8 +466,11 @@ bool SendQueue::isInactive(bool sentAPacket) { using DoubleLock = DoubleLock; DoubleLock doubleLock(_packets.getLock(), _naksLock); DoubleLock::Lock locker(doubleLock, std::try_to_lock); + + auto packetsOnWire = seqlen(SequenceNumber { (uint32_t) _lastACKSequenceNumber }, _currentSequenceNumber); + bool congestionWindowFull = (packetsOnWire > _flowWindowSize); - if (locker.owns_lock() && _packets.isEmpty() && _naks.isEmpty()) { + if (locker.owns_lock() && (_packets.isEmpty() || congestionWindowFull) && _naks.isEmpty()) { // The packets queue and loss list mutexes are now both locked and they're both empty if (uint32_t(_lastACKSequenceNumber) == uint32_t(_currentSequenceNumber)) {