You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ma...@apache.org on 2018/08/14 07:34:05 UTC

[trafficserver] branch quic-latest updated: process early protected data during handshake

This is an automated email from the ASF dual-hosted git repository.

maskit 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 969ac3d  process early protected data during handshake
969ac3d is described below

commit 969ac3dc255b463dd79bd75f3a0eade7b099418f
Author: sunwei <su...@kuaishou.com>
AuthorDate: Sat Aug 4 16:42:26 2018 +0800

    process early protected data during handshake
---
 iocore/net/quic/QUICPacket.cc             | 5 +++++
 iocore/net/quic/QUICPacket.h              | 1 +
 iocore/net/quic/QUICPacketReceiveQueue.cc | 9 +++++++++
 3 files changed, 15 insertions(+)

diff --git a/iocore/net/quic/QUICPacket.cc b/iocore/net/quic/QUICPacket.cc
index 4731b7e..82e0f78 100644
--- a/iocore/net/quic/QUICPacket.cc
+++ b/iocore/net/quic/QUICPacket.cc
@@ -1233,6 +1233,11 @@ QUICPacketFactory::set_hs_protocol(QUICHandshakeProtocol *hs_protocol)
   this->_hs_protocol = hs_protocol;
 }
 
+bool
+QUICPacketFactory::is_ready_to_create_protected_packet()
+{
+  return this->_hs_protocol->is_handshake_finished();
+}
 //
 // QUICPacketNumberGenerator
 //
diff --git a/iocore/net/quic/QUICPacket.h b/iocore/net/quic/QUICPacket.h
index 1aadc80..b43b4e4 100644
--- a/iocore/net/quic/QUICPacket.h
+++ b/iocore/net/quic/QUICPacket.h
@@ -401,6 +401,7 @@ public:
                                                 ats_unique_buf payload, size_t len, bool retransmittable);
   void set_version(QUICVersion negotiated_version);
   void set_hs_protocol(QUICHandshakeProtocol *hs_protocol);
+  bool is_ready_to_create_protected_packet();
 
 private:
   QUICVersion _version                = QUIC_SUPPORTED_VERSIONS[0];
diff --git a/iocore/net/quic/QUICPacketReceiveQueue.cc b/iocore/net/quic/QUICPacketReceiveQueue.cc
index fb09a87..9b0a837 100644
--- a/iocore/net/quic/QUICPacketReceiveQueue.cc
+++ b/iocore/net/quic/QUICPacketReceiveQueue.cc
@@ -156,6 +156,15 @@ QUICPacketReceiveQueue::dequeue(QUICPacketCreationResult &result)
       this->_offset      = 0;
     }
   } else {
+    if (!this->_packet_factory.is_ready_to_create_protected_packet() && udp_packet) {
+      this->enqueue(udp_packet);
+      this->_payload.release();
+      this->_payload     = nullptr;
+      this->_payload_len = 0;
+      this->_offset      = 0;
+      result = QUICPacketCreationResult::NOT_READY;
+      return quic_packet;
+    }
     pkt                = std::move(this->_payload);
     pkt_len            = this->_payload_len;
     this->_payload     = nullptr;