trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mas...@apache.org
Subject [trafficserver] branch quic-latest updated: Allocate buffer for UDP packets with a size of PMTU
Date Tue, 15 Aug 2017 01:51:37 GMT
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 c6b0534  Allocate buffer for UDP packets with a size of PMTU
c6b0534 is described below

commit c6b05347e0616fe666dc6412a76f05291bce68a1
Author: Masakazu Kitajo <maskit@apache.org>
AuthorDate: Tue Aug 15 10:50:15 2017 +0900

    Allocate buffer for UDP packets with a size of PMTU
---
 iocore/net/P_QUICNetProcessor.h     |  3 ++-
 iocore/net/P_QUICNetVConnection.h   |  5 +++--
 iocore/net/QUICNetVConnection.cc    |  6 ++++++
 iocore/net/QUICPacketHandler.cc     |  9 ++++++---
 iocore/net/quic/Mock.h              | 27 ++++++++++++++++++++++++---
 iocore/net/quic/QUICConnection.h    |  7 +++++--
 iocore/net/quic/QUICHandshake.h     |  1 -
 iocore/net/quic/QUICStreamManager.h |  2 +-
 8 files changed, 47 insertions(+), 13 deletions(-)

diff --git a/iocore/net/P_QUICNetProcessor.h b/iocore/net/P_QUICNetProcessor.h
index d6a57fa..f5a2906 100644
--- a/iocore/net/P_QUICNetProcessor.h
+++ b/iocore/net/P_QUICNetProcessor.h
@@ -50,7 +50,8 @@ struct NetAccept;
 //  class QUICNetProcessor
 //
 //////////////////////////////////////////////////////////////////
-class QUICNetProcessor : public UnixNetProcessor {
+class QUICNetProcessor : public UnixNetProcessor
+{
 public:
   QUICNetProcessor();
   virtual ~QUICNetProcessor();
diff --git a/iocore/net/P_QUICNetVConnection.h b/iocore/net/P_QUICNetVConnection.h
index 3eea803..1a143b9 100644
--- a/iocore/net/P_QUICNetVConnection.h
+++ b/iocore/net/P_QUICNetVConnection.h
@@ -153,8 +153,6 @@ public:
   int state_connection_closing(int event, Event *data);
   int state_connection_closed(int event, Event *data);
   void start(SSL_CTX *);
-  uint32_t maximum_quic_packet_size();
-  uint32_t minimum_quic_packet_size();
   void push_packet(std::unique_ptr<const QUICPacket> packet);
   void free(EThread *t) override;
 
@@ -165,6 +163,9 @@ public:
   // QUICConnection
   QUICApplication *get_application(QUICStreamId stream_id) override;
   QUICCrypto *get_crypto() override;
+  uint32_t maximum_quic_packet_size() override;
+  uint32_t minimum_quic_packet_size() override;
+  uint32_t pmtu() override;
   void close(QUICError error) override;
 
   // QUICConnection (QUICPacketTransmitter)
diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index ca963fa..421555a 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -134,6 +134,12 @@ QUICNetVConnection::reenable(VIO *vio)
 }
 
 uint32_t
+QUICNetVConnection::pmtu()
+{
+  return this->_pmtu;
+}
+
+uint32_t
 QUICNetVConnection::minimum_quic_packet_size()
 {
   if (this->options.ip_family == PF_INET6) {
diff --git a/iocore/net/QUICPacketHandler.cc b/iocore/net/QUICPacketHandler.cc
index 47e0505..9286ada 100644
--- a/iocore/net/QUICPacketHandler.cc
+++ b/iocore/net/QUICPacketHandler.cc
@@ -135,10 +135,13 @@ QUICPacketHandler::send_packet(const QUICPacket &packet, QUICNetVConnection
*vc)
     this->_connections.put(packet.connection_id(), vc);
   }
 
-  uint8_t udp_payload[65536];
   size_t udp_len;
-  packet.store(udp_payload, &udp_len);
-  UDPPacket *udpPkt = new_UDPPacket(vc->con.addr, 0, reinterpret_cast<char *>(udp_payload),
udp_len);
+  Ptr<IOBufferBlock> udp_payload(new_IOBufferBlock());
+  udp_payload->alloc(iobuffer_size_to_index(vc->pmtu()));
+  packet.store(reinterpret_cast<uint8_t *>(udp_payload->end()), &udp_len);
+  udp_payload->fill(udp_len);
+
+  UDPPacket *udpPkt = new_UDPPacket(vc->con.addr, 0, udp_payload);
 
   // NOTE: p will be enqueued to udpOutQueue of UDPNetHandler
   ip_port_text_buffer ipb;
diff --git a/iocore/net/quic/Mock.h b/iocore/net/quic/Mock.h
index 6f0b14f..462df2b 100644
--- a/iocore/net/quic/Mock.h
+++ b/iocore/net/quic/Mock.h
@@ -40,17 +40,38 @@ public:
     ++_totalFrameCount;
   }
 
-  QUICApplication *get_application(QUICStreamId stream_id) override
+  QUICApplication *
+  get_application(QUICStreamId stream_id) override
   {
     return nullptr;
   }
 
-  QUICCrypto *get_crypto() override
+  QUICCrypto *
+  get_crypto() override
   {
     return nullptr;
   }
 
-  void close(QUICError error) override
+  uint32_t
+  minimum_quic_packet_size() override
+  {
+    return 1200;
+  }
+
+  uint32_t
+  maximum_quic_packet_size() override
+  {
+    return 1200;
+  }
+
+  uint32_t
+  pmtu() override
+  {
+    return 1280;
+  }
+
+  void
+  close(QUICError error) override
   {
   }
 
diff --git a/iocore/net/quic/QUICConnection.h b/iocore/net/quic/QUICConnection.h
index 236842b..22f373e 100644
--- a/iocore/net/quic/QUICConnection.h
+++ b/iocore/net/quic/QUICConnection.h
@@ -34,6 +34,9 @@ class QUICConnection : public QUICPacketTransmitter, public QUICFrameTransmitter
 {
 public:
   virtual QUICApplication *get_application(QUICStreamId stream_id) = 0;
-  virtual QUICCrypto *get_crypto() = 0;
-  virtual void close(QUICError error) = 0;
+  virtual QUICCrypto *get_crypto()                                 = 0;
+  virtual uint32_t maximum_quic_packet_size()                      = 0;
+  virtual uint32_t minimum_quic_packet_size()                      = 0;
+  virtual uint32_t pmtu()                                          = 0;
+  virtual void close(QUICError error)                              = 0;
 };
diff --git a/iocore/net/quic/QUICHandshake.h b/iocore/net/quic/QUICHandshake.h
index cd2a359..b364a93 100644
--- a/iocore/net/quic/QUICHandshake.h
+++ b/iocore/net/quic/QUICHandshake.h
@@ -27,7 +27,6 @@
 #include "QUICConnection.h"
 #include "QUICApplication.h"
 
-
 /**
  * @class QUICHandshake
  * @brief Do handshake as a QUIC application
diff --git a/iocore/net/quic/QUICStreamManager.h b/iocore/net/quic/QUICStreamManager.h
index 1b03166..7ea2700 100644
--- a/iocore/net/quic/QUICStreamManager.h
+++ b/iocore/net/quic/QUICStreamManager.h
@@ -46,7 +46,7 @@ private:
   QUICStream *_find_or_create_stream(QUICStreamId stream_id);
   QUICStream *_find_stream(QUICStreamId id);
 
-  QUICConnection *_qc   = nullptr;
+  QUICConnection *_qc       = nullptr;
   QUICFrameTransmitter *_tx = nullptr;
 
 private:

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

Mime
View raw message