trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From masa...@apache.org
Subject [trafficserver] 03/08: Fix QUICPacketLongHeader::store for new long header format
Date Wed, 13 Dec 2017 23:44:35 GMT
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 ab3a06b8a88880441539457f4fd314f1a0b55ea1
Author: Masaori Koshiba <masaori@apache.org>
AuthorDate: Tue Dec 12 16:28:11 2017 +0900

    Fix QUICPacketLongHeader::store for new long header format
---
 iocore/net/quic/QUICPacket.cc                  | 14 ++++++++------
 iocore/net/quic/test/test_QUICPacketFactory.cc |  2 +-
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/iocore/net/quic/QUICPacket.cc b/iocore/net/quic/QUICPacket.cc
index 7bf6e81..01802ba 100644
--- a/iocore/net/quic/QUICPacket.cc
+++ b/iocore/net/quic/QUICPacket.cc
@@ -240,17 +240,18 @@ QUICPacketLongHeader::store(uint8_t *buf, size_t *len) const
   buf[0] = 0x80;
   buf[0] += static_cast<uint8_t>(this->_type);
   *len += 1;
+
   QUICTypeUtil::write_QUICConnectionId(this->_connection_id, 8, buf + *len, &n);
   *len += n;
 
+  QUICTypeUtil::write_QUICVersion(this->_version, buf + *len, &n);
+  *len += n;
+
   QUICPacketNumber dst = 0;
   size_t dst_len       = 4;
   QUICPacket::encode_packet_number(dst, this->_packet_number, dst_len);
   QUICTypeUtil::write_QUICPacketNumber(dst, dst_len, buf + *len, &n);
   *len += n;
-
-  QUICTypeUtil::write_QUICVersion(this->_version, buf + *len, &n);
-  *len += n;
 }
 
 //
@@ -699,9 +700,10 @@ QUICPacketFactory::create_version_negotiation_packet(const QUICPacket
*packet_se
     p += n;
   }
 
-  QUICPacketHeader *header = QUICPacketHeader::build(QUICPacketType::VERSION_NEGOTIATION,
packet_sent_by_client->connection_id(),
-                                                     packet_sent_by_client->packet_number(),
base_packet_number,
-                                                     packet_sent_by_client->version(),
std::move(versions), len);
+  QUICPacketHeader *header =
+    QUICPacketHeader::build(QUICPacketType::VERSION_NEGOTIATION, packet_sent_by_client->connection_id(),
+                            packet_sent_by_client->packet_number(), base_packet_number,
0x00, std::move(versions), len);
+
   return QUICPacketFactory::_create_unprotected_packet(header);
 }
 
diff --git a/iocore/net/quic/test/test_QUICPacketFactory.cc b/iocore/net/quic/test/test_QUICPacketFactory.cc
index 9f22800..97d5665 100644
--- a/iocore/net/quic/test/test_QUICPacketFactory.cc
+++ b/iocore/net/quic/test/test_QUICPacketFactory.cc
@@ -35,8 +35,8 @@ TEST_CASE("QUICPacketFactory_Create_VersionNegotiationPacket", "[quic]")
   uint8_t client_initial_packet_header[] = {
     0x82,                                           // Type
     0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, // Connection id
-    0x00, 0x00, 0x00, 0x00,                         // Packet number
     0xaa, 0xbb, 0xcc, 0xdd,                         // Version
+    0x00, 0x00, 0x00, 0x00,                         // Packet number
   };
   uint8_t client_initial_packet_payload[] = {
     0x00 // Payload

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>.

Mime
View raw message