From 6c9021c2886944039b11d2252fc41b49a4121230 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 1 Sep 2015 11:10:19 -0600 Subject: [PATCH] only send second packet of pair when required --- libraries/networking/src/udt/SendQueue.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libraries/networking/src/udt/SendQueue.cpp b/libraries/networking/src/udt/SendQueue.cpp index ff53bcfc54..28f71ec93f 100644 --- a/libraries/networking/src/udt/SendQueue.cpp +++ b/libraries/networking/src/udt/SendQueue.cpp @@ -443,10 +443,12 @@ bool SendQueue::maybeSendNewPacket() { _packets.pop_front(); std::unique_ptr secondPacket; + bool shouldSendPairTail = false; if (((uint32_t) nextNumber & 0xF) == 0) { // the first packet is the first in a probe pair - every 16 (rightmost 16 bits = 0) packets // pull off a second packet if we can before we unlock + shouldSendPairTail = true; if (_packets.size() > 0) { secondPacket.swap(_packets.front()); @@ -463,7 +465,7 @@ bool SendQueue::maybeSendNewPacket() { // do we have a second in a pair to send as well? if (secondPacket) { sendNewPacketAndAddToSentList(move(secondPacket), getNextSequenceNumber()); - } else { + } else if (shouldSendPairTail) { // we didn't get a second packet to send in the probe pair // send a control packet of type ProbePairTail so the receiver can still do // proper bandwidth estimation