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


The following commit(s) were added to refs/heads/quic-latest by this push:
     new c11c12e  Ignore empty stream frames except pure fin stream frame
c11c12e is described below

commit c11c12e3020e2bf4328c6a6df9a58c93ae7f6390
Author: Masaori Koshiba <[email protected]>
AuthorDate: Tue Jun 26 15:14:53 2018 +0900

    Ignore empty stream frames except pure fin stream frame
---
 iocore/net/quic/QUICIncomingFrameBuffer.cc         |  5 +++++
 .../net/quic/test/test_QUICIncomingFrameBuffer.cc  | 22 ++++++++++++++--------
 2 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/iocore/net/quic/QUICIncomingFrameBuffer.cc 
b/iocore/net/quic/QUICIncomingFrameBuffer.cc
index 66eca10..b945ef8 100644
--- a/iocore/net/quic/QUICIncomingFrameBuffer.cc
+++ b/iocore/net/quic/QUICIncomingFrameBuffer.cc
@@ -64,6 +64,11 @@ QUICIncomingFrameBuffer::insert(const std::shared_ptr<const 
QUICStreamFrame> fra
     return err;
   }
 
+  // Ignore empty stream frame except pure fin stream frame
+  if (len == 0 && !frame->has_fin_flag()) {
+    return QUICErrorUPtr(new QUICNoError());
+  }
+
   if (this->_recv_offset > offset) {
     // dup frame;
     return QUICErrorUPtr(new QUICNoError());
diff --git a/iocore/net/quic/test/test_QUICIncomingFrameBuffer.cc 
b/iocore/net/quic/test/test_QUICIncomingFrameBuffer.cc
index 1f6c337..24a069a 100644
--- a/iocore/net/quic/test/test_QUICIncomingFrameBuffer.cc
+++ b/iocore/net/quic/test/test_QUICIncomingFrameBuffer.cc
@@ -74,13 +74,17 @@ TEST_CASE("QUICIncomingFrameBuffer_fin_offset", "[quic]")
 
   SECTION("Pure FIN")
   {
-    std::shared_ptr<QUICStreamFrame> stream1_frame_0_r = 
QUICFrameFactory::create_stream_frame(data, 1024, 1, 0);
-    std::shared_ptr<QUICStreamFrame> stream1_frame_1_r = 
QUICFrameFactory::create_stream_frame(data, 0, 1, 1024, true);
+    std::shared_ptr<QUICStreamFrame> stream1_frame_0_r      = 
QUICFrameFactory::create_stream_frame(data, 1024, 1, 0);
+    std::shared_ptr<QUICStreamFrame> stream1_frame_empty    = 
QUICFrameFactory::create_stream_frame(data, 0, 1, 1024);
+    std::shared_ptr<QUICStreamFrame> stream1_frame_pure_fin = 
QUICFrameFactory::create_stream_frame(data, 0, 1, 1024, true);
 
     err = buffer.insert(stream1_frame_0_r);
     CHECK(err->cls == QUICErrorClass::NONE);
 
-    err = buffer.insert(stream1_frame_1_r);
+    err = buffer.insert(stream1_frame_empty);
+    CHECK(err->cls == QUICErrorClass::NONE);
+
+    err = buffer.insert(stream1_frame_pure_fin);
     CHECK(err->cls == QUICErrorClass::NONE);
   }
 
@@ -95,14 +99,16 @@ TEST_CASE("QUICIncomingFrameBuffer_pop", "[quic]")
 
   uint8_t data[1024] = {0};
 
-  std::shared_ptr<QUICStreamFrame> stream1_frame_0_r = 
QUICFrameFactory::create_stream_frame(data, 1024, 1, 0);
-  std::shared_ptr<QUICStreamFrame> stream1_frame_1_r = 
QUICFrameFactory::create_stream_frame(data, 1024, 1, 1024);
-  std::shared_ptr<QUICStreamFrame> stream1_frame_2_r = 
QUICFrameFactory::create_stream_frame(data, 1024, 1, 2048);
-  std::shared_ptr<QUICStreamFrame> stream1_frame_3_r = 
QUICFrameFactory::create_stream_frame(data, 1024, 1, 3072);
-  std::shared_ptr<QUICStreamFrame> stream1_frame_4_r = 
QUICFrameFactory::create_stream_frame(data, 1024, 1, 4096, true);
+  std::shared_ptr<QUICStreamFrame> stream1_frame_0_r   = 
QUICFrameFactory::create_stream_frame(data, 1024, 1, 0);
+  std::shared_ptr<QUICStreamFrame> stream1_frame_1_r   = 
QUICFrameFactory::create_stream_frame(data, 1024, 1, 1024);
+  std::shared_ptr<QUICStreamFrame> stream1_frame_empty = 
QUICFrameFactory::create_stream_frame(data, 0, 1, 2048);
+  std::shared_ptr<QUICStreamFrame> stream1_frame_2_r   = 
QUICFrameFactory::create_stream_frame(data, 1024, 1, 2048);
+  std::shared_ptr<QUICStreamFrame> stream1_frame_3_r   = 
QUICFrameFactory::create_stream_frame(data, 1024, 1, 3072);
+  std::shared_ptr<QUICStreamFrame> stream1_frame_4_r   = 
QUICFrameFactory::create_stream_frame(data, 1024, 1, 4096, true);
 
   buffer.insert(stream1_frame_0_r);
   buffer.insert(stream1_frame_1_r);
+  buffer.insert(stream1_frame_empty);
   buffer.insert(stream1_frame_2_r);
   buffer.insert(stream1_frame_3_r);
   buffer.insert(stream1_frame_4_r);

Reply via email to