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 d0c9aed QUIC: Bring back retransmittion test case
d0c9aed is described below
commit d0c9aed68f83519b8b9c9a385f031089bdbf8eed
Author: scw00 <[email protected]>
AuthorDate: Mon Mar 11 11:16:15 2019 +0800
QUIC: Bring back retransmittion test case
---
iocore/net/quic/QUICFrameRetransmitter.cc | 6 +++++
iocore/net/quic/QUICFrameRetransmitter.h | 1 +
iocore/net/quic/QUICStream.cc | 5 ++--
iocore/net/quic/test/test_QUICStream.cc | 40 ++++++++++++++++++-------------
4 files changed, 33 insertions(+), 19 deletions(-)
diff --git a/iocore/net/quic/QUICFrameRetransmitter.cc
b/iocore/net/quic/QUICFrameRetransmitter.cc
index 008b72c..bedc654 100644
--- a/iocore/net/quic/QUICFrameRetransmitter.cc
+++ b/iocore/net/quic/QUICFrameRetransmitter.cc
@@ -175,3 +175,9 @@ QUICFrameRetransmitter::_create_crypto_frame(uint8_t *buf,
QUICFrameInformationU
ink_assert(frame != nullptr);
return frame;
}
+
+bool
+QUICFrameRetransmitter::is_retransmited_frame_queue_empty() const
+{
+ return this->_lost_frame_info_queue.empty();
+}
diff --git a/iocore/net/quic/QUICFrameRetransmitter.h
b/iocore/net/quic/QUICFrameRetransmitter.h
index bbd53c3..9f45dd5 100644
--- a/iocore/net/quic/QUICFrameRetransmitter.h
+++ b/iocore/net/quic/QUICFrameRetransmitter.h
@@ -74,6 +74,7 @@ public:
virtual QUICFrame *create_retransmitted_frame(uint8_t *buf,
QUICEncryptionLevel level, uint16_t maximum_frame_size,
QUICFrameId id = 0,
QUICFrameGenerator *owner = nullptr);
virtual void save_frame_info(QUICFrameInformationUPtr info);
+ bool is_retransmited_frame_queue_empty() const;
private:
QUICFrame *_create_stream_frame(uint8_t *buf, QUICFrameInformationUPtr
&info, uint16_t maximum_frame_size,
diff --git a/iocore/net/quic/QUICStream.cc b/iocore/net/quic/QUICStream.cc
index 1e977b7..9c08765 100644
--- a/iocore/net/quic/QUICStream.cc
+++ b/iocore/net/quic/QUICStream.cc
@@ -585,7 +585,8 @@ QUICBidirectionalStream::reenable(VIO *vio)
bool
QUICBidirectionalStream::will_generate_frame(QUICEncryptionLevel level,
ink_hrtime timestamp)
{
- return this->_local_flow_controller.will_generate_frame(level, timestamp) ||
(this->_write_vio.get_reader()->read_avail() > 0);
+ return this->_local_flow_controller.will_generate_frame(level, timestamp) ||
!this->is_retransmited_frame_queue_empty() ||
+ (this->_write_vio.get_reader()->read_avail() > 0);
}
QUICFrame *
@@ -914,7 +915,7 @@ QUICCryptoStream::write(const uint8_t *buf, int64_t len)
bool
QUICCryptoStream::will_generate_frame(QUICEncryptionLevel level, ink_hrtime
timestamp)
{
- return this->_write_buffer_reader->is_read_avail_more_than(0);
+ return this->_write_buffer_reader->is_read_avail_more_than(0) ||
!this->is_retransmited_frame_queue_empty();
}
/**
diff --git a/iocore/net/quic/test/test_QUICStream.cc
b/iocore/net/quic/test/test_QUICStream.cc
index 468e73c..46374d0 100644
--- a/iocore/net/quic/test/test_QUICStream.cc
+++ b/iocore/net/quic/test/test_QUICStream.cc
@@ -301,49 +301,55 @@ TEST_CASE("QUICStream", "[quic]")
/*
* This test does not pass now
- *
+ */
SECTION("Retransmit STREAM frame")
{
- MIOBuffer *write_buffer = new_MIOBuffer(BUFFER_SIZE_INDEX_8K);
+ MIOBuffer *write_buffer = new_MIOBuffer(BUFFER_SIZE_INDEX_8K);
IOBufferReader *write_buffer_reader = write_buffer->alloc_reader();
MockQUICRTTProvider rtt_provider;
MockQUICConnectionInfoProvider cinfo_provider;
- std::unique_ptr<QUICBidirectionalStream> stream(new
QUICBidirectionalStream(&rtt_provider, &cinfo_provider, stream_id,
- UINT64_MAX, UINT64_MAX)); SCOPED_MUTEX_LOCK(lock, stream->mutex,
this_ethread());
+ std::unique_ptr<QUICBidirectionalStream> stream(
+ new QUICBidirectionalStream(&rtt_provider, &cinfo_provider, stream_id,
UINT64_MAX, UINT64_MAX));
+ SCOPED_MUTEX_LOCK(lock, stream->mutex, this_ethread());
MockContinuation mock_cont(stream->mutex);
stream->do_io_write(&mock_cont, INT64_MAX, write_buffer_reader);
QUICEncryptionLevel level = QUICEncryptionLevel::ONE_RTT;
- const char data1[] = "this is a test data";
- const char data2[] = "THIS IS ANOTHER TEST DATA";
- QUICFrameUPtr frame = QUICFrameFactory::create_null_frame();
-
- QUICFrameUPtr frame1 = QUICFrameFactory::create_null_frame();
- QUICFrameUPtr frame2 = QUICFrameFactory::create_null_frame();
+ const char data1[] = "this is a test data";
+ const char data2[] = "THIS IS ANOTHER TEST DATA";
+ QUICFrame *frame = nullptr;
+ QUICStreamFrame *frame1 = nullptr;
+ QUICStreamFrame *frame2 = nullptr;
+ uint8_t frame_buf2[QUICFrame::MAX_INSTANCE_SIZE];
// Write data1
- write_buffer->write(data1, 1024);
+ write_buffer->write(data1, sizeof(data1));
stream->handleEvent(VC_EVENT_WRITE_READY, nullptr);
// Generate STREAM frame
- frame1 = stream->generate_frame(level, 4096, 4096);
+ frame = stream->generate_frame(frame_buf, level, 4096, 4096, 0);
+ frame1 = static_cast<QUICStreamFrame *>(frame);
CHECK(frame->type() == QUICFrameType::STREAM);
- CHECK(stream->generate_frame(level, 4096, 4096) == nullptr);
+ CHECK(stream->generate_frame(frame_buf, level, 4096, 4096, 0) == nullptr);
+ CHECK(stream->will_generate_frame(level, 0) == false);
+ stream->on_frame_lost(frame->id());
+ CHECK(stream->will_generate_frame(level, 0) == true);
+
// Write data2
- write_buffer->write(data1, 1024);
+ write_buffer->write(data2, sizeof(data2));
stream->handleEvent(VC_EVENT_WRITE_READY, nullptr);
// Lost the frame
stream->on_frame_lost(frame->id());
// Regenerate a frame
- frame2 = stream->generate_frame(level, 4096, 4096);
+ frame = stream->generate_frame(frame_buf2, level, 4096, 4096, 0);
// Lost data should be resent first
+ frame2 = static_cast<QUICStreamFrame *>(frame);
CHECK(frame->type() == QUICFrameType::STREAM);
CHECK(frame1->offset() == frame2->offset());
CHECK(frame1->data_length() == frame2->data_length());
- CHECK(memcmp(frame1->data(), frame2->data(), frame1->data_length());
+ CHECK(memcmp(frame1->data(), frame2->data(), frame1->data_length()));
}
- */
SECTION("Retransmit RESET_STREAM frame")
{