This is an automated email from the ASF dual-hosted git repository. masaori pushed a commit to branch quic-latest in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit c7a31b9bdf92e692183116b1e96da3937b535e60 Author: Masaori Koshiba <[email protected]> AuthorDate: Thu Mar 29 09:40:20 2018 +0900 Print First ACK Block when ack received Also rename first_ack_block_length to first_ack_block because it's renamed by draft-08 --- iocore/net/quic/QUICFrame.cc | 23 +++++++++++------------ iocore/net/quic/QUICFrame.h | 16 ++++++++-------- iocore/net/quic/QUICLossDetector.cc | 7 +++++-- iocore/net/quic/test/test_QUICAckFrameCreator.cc | 10 +++++----- iocore/net/quic/test/test_QUICFrame.cc | 4 ++-- 5 files changed, 31 insertions(+), 29 deletions(-) diff --git a/iocore/net/quic/QUICFrame.cc b/iocore/net/quic/QUICFrame.cc index 2e4bc1d..c0d6fe6 100644 --- a/iocore/net/quic/QUICFrame.cc +++ b/iocore/net/quic/QUICFrame.cc @@ -322,13 +322,12 @@ QUICAckFrame::QUICAckFrame(const uint8_t *buf, size_t len, bool protection) : QU this->reset(buf, len); } -QUICAckFrame::QUICAckFrame(QUICPacketNumber largest_acknowledged, uint64_t ack_delay, uint64_t first_ack_block_length, - bool protection) +QUICAckFrame::QUICAckFrame(QUICPacketNumber largest_acknowledged, uint64_t ack_delay, uint64_t first_ack_block, bool protection) : QUICFrame(protection) { this->_largest_acknowledged = largest_acknowledged; this->_ack_delay = ack_delay; - this->_ack_block_section = new AckBlockSection(first_ack_block_length); + this->_ack_block_section = new AckBlockSection(first_ack_block); } QUICAckFrame::~QUICAckFrame() @@ -596,7 +595,7 @@ QUICAckFrame::AckBlockSection::size() const { size_t n = 0; - n += this->_get_first_ack_block_length_size(); + n += this->_get_first_ack_block_size(); for (auto &&block : *this) { n += block.size(); @@ -611,7 +610,7 @@ QUICAckFrame::AckBlockSection::store(uint8_t *buf, size_t *len) const size_t n; uint8_t *p = buf; - QUICIntUtil::write_QUICVariableInt(this->_first_ack_block_length, p, &n); + QUICIntUtil::write_QUICVariableInt(this->_first_ack_block, p, &n); p += n; for (auto &&block : *this) { @@ -625,12 +624,12 @@ QUICAckFrame::AckBlockSection::store(uint8_t *buf, size_t *len) const } uint64_t -QUICAckFrame::AckBlockSection::first_ack_block_length() const +QUICAckFrame::AckBlockSection::first_ack_block() const { if (this->_buf) { return QUICIntUtil::read_QUICVariableInt(this->_buf); } else { - return this->_first_ack_block_length; + return this->_first_ack_block; } } @@ -651,7 +650,7 @@ QUICAckFrame::AckBlockSection::const_iterator QUICAckFrame::AckBlockSection::begin() const { if (this->_buf) { - return const_iterator(0, this->_buf + this->_get_first_ack_block_length_size(), this->_ack_block_count); + return const_iterator(0, this->_buf + this->_get_first_ack_block_size(), this->_ack_block_count); } else { return const_iterator(0, &this->_ack_blocks); } @@ -668,12 +667,12 @@ QUICAckFrame::AckBlockSection::end() const } size_t -QUICAckFrame::AckBlockSection::_get_first_ack_block_length_size() const +QUICAckFrame::AckBlockSection::_get_first_ack_block_size() const { if (this->_buf) { return QUICVariableInt::size(this->_buf); } else { - return QUICVariableInt::size(this->_first_ack_block_length); + return QUICVariableInt::size(this->_first_ack_block); } } @@ -1901,11 +1900,11 @@ QUICFrameFactory::create_stream_frame(const uint8_t *data, size_t data_len, QUIC } std::unique_ptr<QUICAckFrame, QUICFrameDeleterFunc> -QUICFrameFactory::create_ack_frame(QUICPacketNumber largest_acknowledged, uint64_t ack_delay, uint64_t first_ack_block_length, +QUICFrameFactory::create_ack_frame(QUICPacketNumber largest_acknowledged, uint64_t ack_delay, uint64_t first_ack_block, bool protection) { QUICAckFrame *frame = quicAckFrameAllocator.alloc(); - new (frame) QUICAckFrame(largest_acknowledged, ack_delay, first_ack_block_length, protection); + new (frame) QUICAckFrame(largest_acknowledged, ack_delay, first_ack_block, protection); return std::unique_ptr<QUICAckFrame, QUICFrameDeleterFunc>(frame, &QUICFrameDeleter::delete_ack_frame); } diff --git a/iocore/net/quic/QUICFrame.h b/iocore/net/quic/QUICFrame.h index d2ef572..5e21ef4 100644 --- a/iocore/net/quic/QUICFrame.h +++ b/iocore/net/quic/QUICFrame.h @@ -168,30 +168,30 @@ public: const std::vector<QUICAckFrame::AckBlock> *_ack_blocks = nullptr; }; - AckBlockSection(uint64_t first_ack_block_length) : _first_ack_block_length(first_ack_block_length) {} + AckBlockSection(uint64_t first_ack_block) : _first_ack_block(first_ack_block) {} AckBlockSection(const uint8_t *buf, uint8_t ack_block_count) : _buf(buf), _ack_block_count(ack_block_count) {} uint8_t count() const; size_t size() const; void store(uint8_t *buf, size_t *len) const; - uint64_t first_ack_block_length() const; + uint64_t first_ack_block() const; void add_ack_block(const AckBlock block, bool protection = true); const_iterator begin() const; const_iterator end() const; bool has_protected() const; private: - size_t _get_first_ack_block_length_size() const; + size_t _get_first_ack_block_size() const; - const uint8_t *_buf = nullptr; - uint64_t _first_ack_block_length = 0; - uint8_t _ack_block_count = 0; + const uint8_t *_buf = nullptr; + uint64_t _first_ack_block = 0; + uint8_t _ack_block_count = 0; std::vector<QUICAckFrame::AckBlock> _ack_blocks; bool _protection = false; }; QUICAckFrame() : QUICFrame() {} QUICAckFrame(const uint8_t *buf, size_t len, bool protection = true); - QUICAckFrame(QUICPacketNumber largest_acknowledged, uint64_t ack_delay, uint64_t first_ack_block_length, bool protection = true); + QUICAckFrame(QUICPacketNumber largest_acknowledged, uint64_t ack_delay, uint64_t first_ack_block, bool protection = true); virtual ~QUICAckFrame(); virtual void reset(const uint8_t *buf, size_t len) override; @@ -777,7 +777,7 @@ public: * need to ack. */ static std::unique_ptr<QUICAckFrame, QUICFrameDeleterFunc> create_ack_frame(QUICPacketNumber largest_acknowledged, - uint64_t ack_delay, uint64_t first_ack_block_length, + uint64_t ack_delay, uint64_t first_ack_block, bool protection = true); /* * Creates a CONNECTION_CLOSE frame. diff --git a/iocore/net/quic/QUICLossDetector.cc b/iocore/net/quic/QUICLossDetector.cc index 22823de..db18228 100644 --- a/iocore/net/quic/QUICLossDetector.cc +++ b/iocore/net/quic/QUICLossDetector.cc @@ -187,6 +187,9 @@ QUICLossDetector::_on_ack_received(const std::shared_ptr<const QUICAckFrame> &ac QUICLDDebug("Largest Acknowledged: %" PRIu64, ack_frame->largest_acknowledged()); QUICLDDebug("ACK Delay: %" PRIu64, ack_frame->ack_delay()); QUICLDDebug("ACK Block Count: %" PRIu64, ack_frame->ack_block_count()); + if (ack_frame->ack_block_section()) { + QUICLDDebug("First ACK Block: %" PRIu64, ack_frame->ack_block_section()->first_ack_block()); + } this->_largest_acked_packet = ack_frame->largest_acknowledged(); // If the largest acked is newly acked, update the RTT. @@ -474,8 +477,8 @@ QUICLossDetector::_determine_newly_acked_packets(const QUICAckFrame &ack_frame) { std::set<QUICAckFrame::PacketNumberRange> numbers; QUICPacketNumber x = ack_frame.largest_acknowledged(); - numbers.insert({x, static_cast<uint64_t>(x) - ack_frame.ack_block_section()->first_ack_block_length()}); - x -= ack_frame.ack_block_section()->first_ack_block_length() + 1; + numbers.insert({x, static_cast<uint64_t>(x) - ack_frame.ack_block_section()->first_ack_block()}); + x -= ack_frame.ack_block_section()->first_ack_block() + 1; for (auto &&block : *(ack_frame.ack_block_section())) { x -= block.gap() + 1; numbers.insert({x, static_cast<uint64_t>(x) - block.length()}); diff --git a/iocore/net/quic/test/test_QUICAckFrameCreator.cc b/iocore/net/quic/test/test_QUICAckFrameCreator.cc index 9002d6e..a19851e 100644 --- a/iocore/net/quic/test/test_QUICAckFrameCreator.cc +++ b/iocore/net/quic/test/test_QUICAckFrameCreator.cc @@ -41,7 +41,7 @@ TEST_CASE("QUICAckFrameCreator", "[quic]") CHECK(frame != nullptr); CHECK(frame->ack_block_count() == 0); CHECK(frame->largest_acknowledged() == 1); - CHECK(frame->ack_block_section()->first_ack_block_length() == 0); + CHECK(frame->ack_block_section()->first_ack_block() == 0); frame = creator.create(); CHECK(frame == nullptr); @@ -55,7 +55,7 @@ TEST_CASE("QUICAckFrameCreator", "[quic]") CHECK(frame != nullptr); CHECK(frame->ack_block_count() == 0); CHECK(frame->largest_acknowledged() == 5); - CHECK(frame->ack_block_section()->first_ack_block_length() == 3); + CHECK(frame->ack_block_section()->first_ack_block() == 3); // Loss creator.update(6, false, true); @@ -65,7 +65,7 @@ TEST_CASE("QUICAckFrameCreator", "[quic]") CHECK(frame != nullptr); CHECK(frame->ack_block_count() == 1); CHECK(frame->largest_acknowledged() == 10); - CHECK(frame->ack_block_section()->first_ack_block_length() == 0); + CHECK(frame->ack_block_section()->first_ack_block() == 0); CHECK(frame->ack_block_section()->begin()->gap() == 1); } @@ -88,7 +88,7 @@ TEST_CASE("QUICAckFrameCreator_loss_recover", "[quic]") CHECK(frame != nullptr); CHECK(frame->ack_block_count() == 2); CHECK(frame->largest_acknowledged() == 9); - CHECK(frame->ack_block_section()->first_ack_block_length() == 1); + CHECK(frame->ack_block_section()->first_ack_block() == 1); CHECK(frame->ack_block_section()->begin()->gap() == 0); frame = creator.create(); @@ -100,7 +100,7 @@ TEST_CASE("QUICAckFrameCreator_loss_recover", "[quic]") CHECK(frame != nullptr); CHECK(frame->ack_block_count() == 1); CHECK(frame->largest_acknowledged() == 7); - CHECK(frame->ack_block_section()->first_ack_block_length() == 0); + CHECK(frame->ack_block_section()->first_ack_block() == 0); CHECK(frame->ack_block_section()->begin()->gap() == 1); } diff --git a/iocore/net/quic/test/test_QUICFrame.cc b/iocore/net/quic/test/test_QUICFrame.cc index 4623a9c..ac37d8b 100644 --- a/iocore/net/quic/test/test_QUICFrame.cc +++ b/iocore/net/quic/test/test_QUICFrame.cc @@ -364,7 +364,7 @@ TEST_CASE("Load Ack Frame 1", "[quic]") CHECK(ack_frame1->ack_block_count() == 0); const QUICAckFrame::AckBlockSection *section = ack_frame1->ack_block_section(); - CHECK(section->first_ack_block_length() == 0x01); + CHECK(section->first_ack_block() == 0x01); } SECTION("2 Ack Block, 8 bit packet number length, 8 bit block length") @@ -391,7 +391,7 @@ TEST_CASE("Load Ack Frame 1", "[quic]") CHECK(ack_frame1->ack_block_count() == 2); const QUICAckFrame::AckBlockSection *section = ack_frame1->ack_block_section(); - CHECK(section->first_ack_block_length() == 0x01); + CHECK(section->first_ack_block() == 0x01); auto ite = section->begin(); CHECK(ite != section->end()); CHECK(ite->gap() == 0x02); -- To stop receiving notification emails like this one, please contact [email protected].
