From 74a2d985ebb1fd6a985d1d516e79b67102557a43 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 31 Jul 2015 19:17:02 -0700 Subject: [PATCH] tell the send queue about ACKs on light ACK --- libraries/networking/src/udt/Connection.cpp | 13 ++++++++----- tools/udt-test/src/UDTTest.cpp | 5 +++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/libraries/networking/src/udt/Connection.cpp b/libraries/networking/src/udt/Connection.cpp index 24911d04cb..8ad7259347 100644 --- a/libraries/networking/src/udt/Connection.cpp +++ b/libraries/networking/src/udt/Connection.cpp @@ -102,7 +102,7 @@ void Connection::sendACK(bool wasCausedBySyncTimeout) { if (nextACKNumber == _lastSentACK) { // We already sent this ACK, but check if we should re-send it. - if (nextACKNumber <= _lastReceivedAcknowledgedACK) { + if (nextACKNumber < _lastReceivedAcknowledgedACK) { // we already got an ACK2 for this ACK we would be sending, don't bother return; } @@ -375,11 +375,11 @@ void Connection::processACK(std::unique_ptr controlPacket) { // read the ACKed sequence number SequenceNumber ack; controlPacket->readPrimitive(&ack); - + // validate that this isn't a BS ACK if (ack > getSendQueue().getCurrentSequenceNumber()) { // in UDT they specifically break the connection here - do we want to do anything? - Q_ASSERT_X(true, "Connection::processACK", "ACK recieved higher than largest sent sequence number"); + Q_ASSERT_X(false, "Connection::processACK", "ACK recieved higher than largest sent sequence number"); return; } @@ -388,7 +388,7 @@ void Connection::processACK(std::unique_ptr controlPacket) { controlPacket->readPrimitive(&rtt); if (ack < _lastReceivedACK) { - // Bail + // this is an out of order ACK, bail return; } @@ -396,7 +396,7 @@ void Connection::processACK(std::unique_ptr controlPacket) { controlPacket->readPrimitive(&_flowWindowSize); if (ack == _lastReceivedACK) { - // Bail + // processing an already received ACK, bail return; } @@ -455,6 +455,9 @@ void Connection::processLightACK(std::unique_ptr controlPacket) { // update the last received ACK to the this one _lastReceivedACK = ack; + + // send light ACK to the send queue + getSendQueue().ack(ack); } _stats.recordReceivedLightACK(); diff --git a/tools/udt-test/src/UDTTest.cpp b/tools/udt-test/src/UDTTest.cpp index d0c7b159df..97de033dfe 100644 --- a/tools/udt-test/src/UDTTest.cpp +++ b/tools/udt-test/src/UDTTest.cpp @@ -42,7 +42,7 @@ const QCommandLineOption UNRELIABLE_PACKETS { }; const QStringList STATS_TABLE_HEADERS { - "Send Rate (P/s)", "RTT(ms)", "CW (P)", "Send Period (us)", "Received ACK", "Received NAK", "Sent ACK2" + "Send Rate (P/s)", "RTT(ms)", "CW (P)", "Send Period (us)", "Received ACK", "Received NAK", "Sent ACK2", "Re-sent Packets" }; UDTTest::UDTTest(int& argc, char** argv) : @@ -228,7 +228,8 @@ void UDTTest::sampleStats() { QString::number(stats.packetSendPeriod).leftJustified(STATS_TABLE_HEADERS[++headerIndex].size()), QString::number(stats.receivedACKs).leftJustified(STATS_TABLE_HEADERS[++headerIndex].size()), QString::number(stats.receivedNAKs).leftJustified(STATS_TABLE_HEADERS[++headerIndex].size()), - QString::number(stats.sentACK2s).leftJustified(STATS_TABLE_HEADERS[++headerIndex].size()) + QString::number(stats.sentACK2s).leftJustified(STATS_TABLE_HEADERS[++headerIndex].size()), + QString::number(stats.retransmissions).leftJustified(STATS_TABLE_HEADERS[++headerIndex].size()) }; // output this line of values