trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sc...@apache.org
Subject [trafficserver] branch quic-latest updated: QUIC: AckCreator only response to non-ack-only packet
Date Fri, 15 Feb 2019 05:02:53 GMT
This is an automated email from the ASF dual-hosted git repository.

scw00 pushed a commit to branch quic-latest
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/quic-latest by this push:
     new 0b84cf3  QUIC: AckCreator only response to non-ack-only packet
0b84cf3 is described below

commit 0b84cf33d14accb558fa9e9b695d13a0f394868a
Author: scw00 <scw00@apache.org>
AuthorDate: Fri Feb 15 11:29:28 2019 +0800

    QUIC: AckCreator only response to non-ack-only packet
---
 iocore/net/quic/QUICAckFrameCreator.cc           |  2 +-
 iocore/net/quic/test/test_QUICAckFrameCreator.cc | 67 ++++++++++++++++++++++++
 2 files changed, 68 insertions(+), 1 deletion(-)

diff --git a/iocore/net/quic/QUICAckFrameCreator.cc b/iocore/net/quic/QUICAckFrameCreator.cc
index 7214fdc..55b8d6f 100644
--- a/iocore/net/quic/QUICAckFrameCreator.cc
+++ b/iocore/net/quic/QUICAckFrameCreator.cc
@@ -193,7 +193,7 @@ QUICAckFrameManager::QUICAckFrameCreator::push_back(QUICPacketNumber packet_numb
   }
 
   // can not delay handshake packet
-  if (this->_level == QUICEncryptionLevel::INITIAL || this->_level == QUICEncryptionLevel::HANDSHAKE)
{
+  if ((this->_level == QUICEncryptionLevel::INITIAL || this->_level == QUICEncryptionLevel::HANDSHAKE)
&& !ack_only) {
     this->_should_send = true;
   }
 
diff --git a/iocore/net/quic/test/test_QUICAckFrameCreator.cc b/iocore/net/quic/test/test_QUICAckFrameCreator.cc
index 15b1e13..7e0d410 100644
--- a/iocore/net/quic/test/test_QUICAckFrameCreator.cc
+++ b/iocore/net/quic/test/test_QUICAckFrameCreator.cc
@@ -343,3 +343,70 @@ TEST_CASE("QUICAckFrameManager lost_frame", "[quic]")
 
   CHECK(ack_manager.will_generate_frame(level) == false);
 }
+
+TEST_CASE("QUICAckFrameManager ack only packet", "[quic]")
+{
+  SECTION("INITIAL")
+  {
+    QUICAckFrameManager ack_manager;
+    QUICEncryptionLevel level = QUICEncryptionLevel::INITIAL;
+    uint8_t frame_buf[QUICFrame::MAX_INSTANCE_SIZE];
+
+    // Initial state
+    QUICFrame *ack_frame = ack_manager.generate_frame(frame_buf, level, UINT16_MAX, UINT16_MAX);
+    QUICAckFrame *frame  = static_cast<QUICAckFrame *>(ack_frame);
+    CHECK(frame == nullptr);
+
+    ack_manager.update(level, 1, 1, false);
+    ack_manager.update(level, 2, 1, false);
+    ack_manager.update(level, 3, 1, false);
+    ack_manager.update(level, 4, 1, false);
+    ack_manager.update(level, 5, 1, false);
+
+    CHECK(ack_manager.will_generate_frame(level) == true);
+
+    ack_frame = ack_manager.generate_frame(frame_buf, level, UINT16_MAX, UINT16_MAX);
+    frame     = static_cast<QUICAckFrame *>(ack_frame);
+    CHECK(frame != nullptr);
+    CHECK(frame->ack_block_count() == 0);
+    CHECK(frame->largest_acknowledged() == 5);
+    CHECK(frame->ack_block_section()->first_ack_block() == 4);
+    CHECK(frame->ack_block_section()->begin()->gap() == 0);
+
+    ack_manager.update(level, 6, 1, true);
+    ack_manager.update(level, 7, 1, true);
+    CHECK(ack_manager.will_generate_frame(level) == false);
+  }
+
+  SECTION("ONE_RTT")
+  {
+    QUICAckFrameManager ack_manager;
+    QUICEncryptionLevel level = QUICEncryptionLevel::ONE_RTT;
+    uint8_t frame_buf[QUICFrame::MAX_INSTANCE_SIZE];
+
+    // Initial state
+    QUICFrame *ack_frame = ack_manager.generate_frame(frame_buf, level, UINT16_MAX, UINT16_MAX);
+    QUICAckFrame *frame  = static_cast<QUICAckFrame *>(ack_frame);
+    CHECK(frame == nullptr);
+
+    ack_manager.update(level, 1, 1, false);
+    ack_manager.update(level, 2, 1, false);
+    ack_manager.update(level, 3, 1, false);
+    ack_manager.update(level, 4, 1, false);
+    ack_manager.update(level, 5, 1, false);
+
+    CHECK(ack_manager.will_generate_frame(level) == true);
+
+    ack_frame = ack_manager.generate_frame(frame_buf, level, UINT16_MAX, UINT16_MAX);
+    frame     = static_cast<QUICAckFrame *>(ack_frame);
+    CHECK(frame != nullptr);
+    CHECK(frame->ack_block_count() == 0);
+    CHECK(frame->largest_acknowledged() == 5);
+    CHECK(frame->ack_block_section()->first_ack_block() == 4);
+    CHECK(frame->ack_block_section()->begin()->gap() == 0);
+
+    ack_manager.update(level, 6, 1, true);
+    ack_manager.update(level, 7, 1, true);
+    CHECK(ack_manager.will_generate_frame(level) == false);
+  }
+}


Mime
View raw message