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

commit c4a8ea6adaf59b234f299f38935aa68362dc8617
Author: Masakazu Kitajo <mas...@apache.org>
AuthorDate: Mon Aug 14 16:55:05 2017 +0900

    Handle CONNECTION_CLOSE frame on QUICNetVConnection
    
    Integrate QUICConnectionManager into QUICNetVConnection.
---
 iocore/net/P_QUICNetVConnection.h                  |  29 +++--
 iocore/net/QUICNetVConnection.cc                   | 117 ++++++++++++++-------
 iocore/net/quic/Makefile.am                        |   1 -
 iocore/net/quic/Mock.h                             |  87 +++++++--------
 .../{QUICConnectionManager.h => QUICConnection.h}  |  14 +--
 iocore/net/quic/QUICConnectionManager.cc           |  42 --------
 iocore/net/quic/QUICFrameDispatcher.cc             |  11 +-
 iocore/net/quic/QUICFrameDispatcher.h              |   6 +-
 iocore/net/quic/QUICFrameHandler.h                 |   1 +
 iocore/net/quic/QUICPacket.cc                      |   4 +-
 iocore/net/quic/test/Makefile.am                   |   2 -
 iocore/net/quic/test/test_QUICFrameDispatcher.cc   |   8 +-
 12 files changed, 162 insertions(+), 160 deletions(-)

diff --git a/iocore/net/P_QUICNetVConnection.h 
b/iocore/net/P_QUICNetVConnection.h
index 09caae2..3bba2e8 100644
--- a/iocore/net/P_QUICNetVConnection.h
+++ b/iocore/net/P_QUICNetVConnection.h
@@ -42,6 +42,7 @@
 #include "ts/apidefs.h"
 #include "ts/List.h"
 
+#include "quic/QUICConnection.h"
 #include "quic/QUICVersionNegotiator.h"
 #include "quic/QUICPacket.h"
 #include "quic/QUICFrame.h"
@@ -52,10 +53,7 @@
 #include "quic/QUICCrypto.h"
 #include "quic/QUICAckFrameCreator.h"
 #include "quic/QUICLossDetector.h"
-#include "quic/QUICPacketTransmitter.h"
-#include "quic/QUICFrameTransmitter.h"
 #include "quic/QUICStreamManager.h"
-#include "quic/QUICConnectionManager.h"
 #include "quic/QUICFlowController.h"
 #include "quic/QUICCongestionController.h"
 
@@ -134,13 +132,19 @@ class QUICLossDetector;
  *  | WRITE:
  *  |   _state_common_send_packet()
  *  v
+ * state_connection_closing() (If closing actively)
+ *  | READ:
+ *  |   _state_connection_established_process_packet()
+ *  | WRITE:
+ *  |   _state_common_send_packet()
+ *  v
  * state_connection_close()
  *    READ:
  *      Do nothing
  *    WRITE:
  *      _state_common_send_packet()
  **/
-class QUICNetVConnection : public UnixNetVConnection, public 
QUICPacketTransmitter, public QUICFrameTransmitter
+class QUICNetVConnection : public UnixNetVConnection, public QUICConnection
 {
   typedef UnixNetVConnection super; ///< Parent type.
 
@@ -155,15 +159,12 @@ public:
   int startEvent(int event, Event *e);
   int state_handshake(int event, Event *data);
   int state_connection_established(int event, Event *data);
+  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();
-  virtual void transmit_packet(std::unique_ptr<const QUICPacket> packet) 
override;
-  virtual void retransmit_packet(const QUICPacket &packet) override;
-  virtual Ptr<ProxyMutex> get_transmitter_mutex() override;
   void push_packet(std::unique_ptr<const QUICPacket> packet);
-  virtual void transmit_frame(std::unique_ptr<QUICFrame, QUICFrameDeleterFunc> 
frame) override;
   void close(QUICError error);
   void free(EThread *t) override;
 
@@ -174,6 +175,17 @@ public:
   virtual void net_read_io(NetHandler *nh, EThread *lthread) override;
   virtual int64_t load_buffer_and_write(int64_t towrite, MIOBufferAccessor 
&buf, int64_t &total_written, int &needs) override;
 
+  // QUICConnection (QUICPacketTransmitter)
+  virtual void transmit_packet(std::unique_ptr<const QUICPacket> packet) 
override;
+  virtual void retransmit_packet(const QUICPacket &packet) override;
+  virtual Ptr<ProxyMutex> get_transmitter_mutex() override;
+
+  // QUICConnection (QUICFrameTransmitter)
+  virtual void transmit_frame(std::unique_ptr<QUICFrame, QUICFrameDeleterFunc> 
frame) override;
+
+  // QUICConnection (QUICFrameHandler)
+  void handle_frame(std::shared_ptr<const QUICFrame> frame) override;
+
 private:
   QUICConnectionId _quic_connection_id;
   UDPConnection *_udp_con            = nullptr;
@@ -209,6 +221,7 @@ private:
   QUICError 
_state_handshake_process_client_cleartext_packet(std::unique_ptr<const 
QUICPacket> packet);
   QUICError 
_state_handshake_process_zero_rtt_protected_packet(std::unique_ptr<const 
QUICPacket> packet);
   QUICError _state_connection_established_process_packet(std::unique_ptr<const 
QUICPacket> packet);
+  QUICError _state_common_receive_packet();
   QUICError _state_common_send_packet();
 
   Ptr<ProxyMutex> _transmitter_mutex;
diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index 08477fe..da12ede 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -97,11 +97,10 @@ QUICNetVConnection::start(SSL_CTX *ssl_ctx)
   this->_stream_manager->init(this);
   this->_stream_manager->set_connection(this); // FIXME Want to remove;
 
-  std::shared_ptr<QUICConnectionManager> connectionManager       = 
std::make_shared<QUICConnectionManager>(this);
   std::shared_ptr<QUICFlowController> flowController             = 
std::make_shared<QUICFlowController>();
   std::shared_ptr<QUICCongestionController> congestionController = 
std::make_shared<QUICCongestionController>();
   this->_frame_dispatcher =
-    new QUICFrameDispatcher(connectionManager, this->_stream_manager, 
flowController, congestionController, this->_loss_detector);
+    new QUICFrameDispatcher(this, this->_stream_manager, flowController, 
congestionController, this->_loss_detector);
 }
 
 void
@@ -212,7 +211,29 @@ 
QUICNetVConnection::transmit_frame(std::unique_ptr<QUICFrame, QUICFrameDeleterFu
 void
 QUICNetVConnection::close(QUICError error)
 {
-  
this->transmit_frame(QUICFrameFactory::create_connection_close_frame(error.code,
 0, ""));
+  if (this->handler == 
reinterpret_cast<ContinuationHandler>(&QUICNetVConnection::state_connection_closed)
 ||
+      this->handler == 
reinterpret_cast<ContinuationHandler>(&QUICNetVConnection::state_connection_closing))
 {
+    // do nothing
+  } else {
+    DebugQUICCon("Enter state_connection_closing");
+    
SET_HANDLER((NetVConnHandler)&QUICNetVConnection::state_connection_closing);
+    
this->transmit_frame(QUICFrameFactory::create_connection_close_frame(error.code,
 0, ""));
+  }
+}
+
+void
+QUICNetVConnection::handle_frame(std::shared_ptr<const QUICFrame> frame)
+{
+  switch (frame->type()) {
+  case QUICFrameType::CONNECTION_CLOSE:
+    DebugQUICCon("Enter state_connection_closed");
+    SET_HANDLER((NetVConnHandler)&QUICNetVConnection::state_connection_closed);
+    break;
+  default:
+    DebugQUICCon("Unexpected frame type: %02x", static_cast<unsigned 
int>(frame->type()));
+    ink_assert(false);
+    break;
+  }
 }
 
 // TODO: Timeout by active_timeout / inactive_timeout
@@ -286,18 +307,7 @@ QUICNetVConnection::state_connection_established(int 
event, Event *data)
   QUICError error;
   switch (event) {
   case QUIC_EVENT_PACKET_READ_READY: {
-    std::unique_ptr<const QUICPacket> p = std::unique_ptr<const 
QUICPacket>(this->_packet_recv_queue.dequeue());
-    net_activity(this, this_ethread());
-
-    switch (p->type()) {
-    case QUICPacketType::ONE_RTT_PROTECTED_KEY_PHASE_0:
-    case QUICPacketType::ONE_RTT_PROTECTED_KEY_PHASE_1:
-      error = this->_state_connection_established_process_packet(std::move(p));
-      break;
-    default:
-      error = QUICError(QUICErrorClass::QUIC_TRANSPORT, 
QUICErrorCode::QUIC_INTERNAL_ERROR);
-      break;
-    }
+    error = this->_state_common_receive_packet();
     break;
   }
   case QUIC_EVENT_PACKET_WRITE_READY: {
@@ -306,16 +316,11 @@ QUICNetVConnection::state_connection_established(int 
event, Event *data)
   }
 
   case EVENT_IMMEDIATE: {
-    // Start Implicit Shutdown. Because no network activity for the duration 
of the idle timeout.
+    // Start Implicit Shutdown. Because of no network activity for the 
duration of the idle timeout.
     this->remove_from_active_queue();
+    this->close({});
 
     // TODO: signal VC_EVENT_ACTIVE_TIMEOUT/VC_EVENT_INACTIVITY_TIMEOUT to 
application
-    DebugQUICCon("Enter state_connection_close");
-    this->_state = QUICConnectionState::Closing;
-    SET_HANDLER((NetVConnHandler)&QUICNetVConnection::state_connection_closed);
-
-    this->close({QUICErrorClass::NONE, QUICErrorCode::QUIC_TRANSPORT_ERROR});
-
     break;
   }
   default:
@@ -331,6 +336,32 @@ QUICNetVConnection::state_connection_established(int 
event, Event *data)
 }
 
 int
+QUICNetVConnection::state_connection_closing(int event, Event *data)
+{
+  QUICError error;
+  switch (event) {
+  case QUIC_EVENT_PACKET_READ_READY: {
+    error = this->_state_common_receive_packet();
+    break;
+  }
+  case QUIC_EVENT_PACKET_WRITE_READY: {
+    this->_state_common_send_packet();
+    break;
+  }
+  default:
+    DebugQUICCon("Unexpected event: %u", event);
+  }
+
+  // FIXME Enter closed state if CONNECTION_CLOSE was ACKed
+  if (true) {
+    DebugQUICCon("Enter state_connection_closed");
+    SET_HANDLER((NetVConnHandler)&QUICNetVConnection::state_connection_closed);
+  }
+
+  return EVENT_DONE;
+}
+
+int
 QUICNetVConnection::state_connection_closed(int event, Event *data)
 {
   switch (event) {
@@ -339,24 +370,17 @@ QUICNetVConnection::state_connection_closed(int event, 
Event *data)
     break;
   }
   case QUIC_EVENT_PACKET_WRITE_READY: {
-    // TODO: Retransmit CONNECTION_CLOSE when Explicit Shutdown (Out of scope 
from first implementation)
-    // Inplicit Shutdown
-    if (this->_state == QUICConnectionState::Closing) {
-      this->_state_common_send_packet();
-      this->_state = QUICConnectionState::Closed;
-
-      this->next_inactivity_timeout_at = 0;
-      this->next_activity_timeout_at   = 0;
+    this->next_inactivity_timeout_at = 0;
+    this->next_activity_timeout_at   = 0;
 
-      this->inactivity_timeout_in = 0;
-      this->active_timeout_in     = 0;
+    this->inactivity_timeout_in = 0;
+    this->active_timeout_in     = 0;
 
-      // TODO: Drop record from Connection-ID - QUICNetVConnection table in 
QUICPacketHandler
-      // Shutdown loss detector
-      this->_loss_detector->handleEvent(QUIC_EVENT_LD_SHUTDOWN, nullptr);
+    // TODO: Drop record from Connection-ID - QUICNetVConnection table in 
QUICPacketHandler
+    // Shutdown loss detector
+    this->_loss_detector->handleEvent(QUIC_EVENT_LD_SHUTDOWN, nullptr);
 
-      this->free(this_ethread());
-    }
+    this->free(this_ethread());
 
     break;
   }
@@ -493,6 +517,25 @@ 
QUICNetVConnection::_state_connection_established_process_packet(std::unique_ptr
 }
 
 QUICError
+QUICNetVConnection::_state_common_receive_packet()
+{
+  QUICError error;
+  std::unique_ptr<const QUICPacket> p = std::unique_ptr<const 
QUICPacket>(this->_packet_recv_queue.dequeue());
+  net_activity(this, this_ethread());
+
+  switch (p->type()) {
+  case QUICPacketType::ONE_RTT_PROTECTED_KEY_PHASE_0:
+  case QUICPacketType::ONE_RTT_PROTECTED_KEY_PHASE_1:
+    error = this->_state_connection_established_process_packet(std::move(p));
+    break;
+  default:
+    error = QUICError(QUICErrorClass::QUIC_TRANSPORT, 
QUICErrorCode::QUIC_INTERNAL_ERROR);
+    break;
+  }
+  return error;
+}
+
+QUICError
 QUICNetVConnection::_state_common_send_packet()
 {
   this->_packetize_frames();
diff --git a/iocore/net/quic/Makefile.am b/iocore/net/quic/Makefile.am
index 714874c..21e1fca 100644
--- a/iocore/net/quic/Makefile.am
+++ b/iocore/net/quic/Makefile.am
@@ -45,7 +45,6 @@ libquic_a_SOURCES = \
   QUICFrame.cc \
   QUICFrameDispatcher.cc \
   QUICVersionNegotiator.cc \
-  QUICConnectionManager.cc \
   QUICLossDetector.cc \
   QUICStreamManager.cc \
   QUICFlowController.cc \
diff --git a/iocore/net/quic/Mock.h b/iocore/net/quic/Mock.h
index 9483ce3..164b808 100644
--- a/iocore/net/quic/Mock.h
+++ b/iocore/net/quic/Mock.h
@@ -1,4 +1,3 @@
-#include "QUICConnectionManager.h"
 #include "QUICStreamManager.h"
 #include "QUICFlowController.h"
 #include "QUICCongestionController.h"
@@ -6,10 +5,10 @@
 #include "QUICEvents.h"
 #include "QUICPacketTransmitter.h"
 
-class MockQUICPacketTransmitter : public QUICPacketTransmitter
+class MockQUICConnection : public QUICConnection
 {
 public:
-  MockQUICPacketTransmitter() : QUICPacketTransmitter() { this->_mutex = 
new_ProxyMutex(); };
+  MockQUICConnection() : QUICConnection() { this->_mutex = new_ProxyMutex(); };
 
   void
   transmit_packet(std::unique_ptr<const QUICPacket> packet) override
@@ -29,76 +28,78 @@ public:
     return this->_mutex;
   }
 
-  int _transmit_count   = 0;
-  int _retransmit_count = 0;
-  Ptr<ProxyMutex> _mutex;
-};
-
-class MockQUICFrameTransmitter : public QUICFrameTransmitter
-{
   void
-  transmit_frame(std::unique_ptr<QUICFrame, QUICFrameDeleterFunc> frame)
+  transmit_frame(std::unique_ptr<QUICFrame, QUICFrameDeleterFunc> frame) 
override
   {
   }
-};
-
-class MockQUICLossDetector : public QUICLossDetector
-{
-public:
-  MockQUICLossDetector() : QUICLossDetector(new MockQUICPacketTransmitter()) {}
 
   void
-  rcv_frame(std::shared_ptr<const QUICFrame>)
+  handle_frame(std::shared_ptr<const QUICFrame> f) override
   {
   }
 
-  void
-  on_packet_sent(std::unique_ptr<const QUICPacket> packet)
+  int
+  getTotalFrameCount()
   {
+    return _totalFrameCount;
   }
+
+  int _transmit_count   = 0;
+  int _retransmit_count = 0;
+  Ptr<ProxyMutex> _mutex;
+  int _totalFrameCount = 0;
 };
 
-class MockQUICConnectionManager : public QUICConnectionManager
+class MockQUICPacketTransmitter : public QUICPacketTransmitter
 {
 public:
-  MockQUICConnectionManager() : QUICConnectionManager(new 
MockQUICFrameTransmitter()) {}
+  MockQUICPacketTransmitter() : QUICPacketTransmitter() { this->_mutex = 
new_ProxyMutex(); };
 
-  // Override
-  virtual void
-  handle_frame(std::shared_ptr<const QUICFrame> f) override
+  void
+  transmit_packet(std::unique_ptr<const QUICPacket> packet) override
   {
-    ++_frameCount[static_cast<int>(f->type())];
-    ++_totalFrameCount;
+    ++_transmit_count;
   }
 
-  // for Test
-  int
-  getStreamFrameCount()
+  void
+  retransmit_packet(const QUICPacket &packet) override
   {
-    return _frameCount[static_cast<int>(QUICFrameType::STREAM)];
+    ++_retransmit_count;
   }
 
-  int
-  getAckFrameCount()
+  Ptr<ProxyMutex>
+  get_transmitter_mutex() override
   {
-    return _frameCount[static_cast<int>(QUICFrameType::ACK)];
+    return this->_mutex;
   }
 
-  int
-  getPingFrameCount()
+  int _transmit_count   = 0;
+  int _retransmit_count = 0;
+  Ptr<ProxyMutex> _mutex;
+};
+
+class MockQUICFrameTransmitter : public QUICFrameTransmitter
+{
+  void
+  transmit_frame(std::unique_ptr<QUICFrame, QUICFrameDeleterFunc> frame)
   {
-    return _frameCount[static_cast<int>(QUICFrameType::PING)];
   }
+};
 
-  int
-  getTotalFrameCount()
+class MockQUICLossDetector : public QUICLossDetector
+{
+public:
+  MockQUICLossDetector() : QUICLossDetector(new MockQUICPacketTransmitter()) {}
+
+  void
+  rcv_frame(std::shared_ptr<const QUICFrame>)
   {
-    return _totalFrameCount;
   }
 
-private:
-  int _totalFrameCount = 0;
-  int _frameCount[256] = {0};
+  void
+  on_packet_sent(std::unique_ptr<const QUICPacket> packet)
+  {
+  }
 };
 
 class MockQUICStreamManager : public QUICStreamManager
diff --git a/iocore/net/quic/QUICConnectionManager.h 
b/iocore/net/quic/QUICConnection.h
similarity index 72%
rename from iocore/net/quic/QUICConnectionManager.h
rename to iocore/net/quic/QUICConnection.h
index 3a67734..bf71ba8 100644
--- a/iocore/net/quic/QUICConnectionManager.h
+++ b/iocore/net/quic/QUICConnection.h
@@ -23,18 +23,10 @@
 
 #pragma once
 
-#include <QUICFrameHandler.h>
-#include <QUICFrame.h>
+#include "QUICPacketTransmitter.h"
 #include "QUICFrameTransmitter.h"
+#include "QUICFrameHandler.h"
 
-class QUICConnectionManager : public QUICFrameHandler
+class QUICConnection : public QUICPacketTransmitter, public 
QUICFrameTransmitter, public QUICFrameHandler
 {
-public:
-  QUICConnectionManager(QUICFrameTransmitter *tx) : _tx(tx){};
-  virtual void handle_frame(std::shared_ptr<const QUICFrame> frame) override;
-
-private:
-  QUICFrameTransmitter *_tx = nullptr;
-
-  void _handle_ping_frame(const QUICPingFrame *);
 };
diff --git a/iocore/net/quic/QUICConnectionManager.cc 
b/iocore/net/quic/QUICConnectionManager.cc
deleted file mode 100644
index 85654f2..0000000
--- a/iocore/net/quic/QUICConnectionManager.cc
+++ /dev/null
@@ -1,42 +0,0 @@
-/** @file
- *
- *  A brief file description
- *
- *  @section license License
- *
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-#include <QUICConnectionManager.h>
-
-const static char *tag = "quic_connection_manager";
-
-void
-QUICConnectionManager::handle_frame(std::shared_ptr<const QUICFrame> frame)
-{
-  switch (frame->type()) {
-  case QUICFrameType::CONNECTION_CLOSE:
-  case QUICFrameType::STREAM:
-  case QUICFrameType::GOAWAY:
-  case QUICFrameType::PING:
-    break;
-  default:
-    Debug(tag, "Unexpected frame type: %02x", static_cast<unsigned 
int>(frame->type()));
-    ink_assert(false);
-    break;
-  }
-}
diff --git a/iocore/net/quic/QUICFrameDispatcher.cc 
b/iocore/net/quic/QUICFrameDispatcher.cc
index faf664a..724e04f 100644
--- a/iocore/net/quic/QUICFrameDispatcher.cc
+++ b/iocore/net/quic/QUICFrameDispatcher.cc
@@ -22,7 +22,7 @@
  */
 
 #include "QUICFrameDispatcher.h"
-#include "QUICConnectionManager.h"
+#include "QUICConnection.h"
 #include "QUICStreamManager.h"
 #include "QUICFlowController.h"
 #include "QUICCongestionController.h"
@@ -34,13 +34,12 @@ const static char *tag = "quic_frame_handler";
 //
 // Frame Dispatcher
 //
-QUICFrameDispatcher::QUICFrameDispatcher(const 
std::shared_ptr<QUICConnectionManager> cmgr,
-                                         const 
std::shared_ptr<QUICStreamManager> smgr,
+QUICFrameDispatcher::QUICFrameDispatcher(QUICConnection *connection, const 
std::shared_ptr<QUICStreamManager> smgr,
                                          const 
std::shared_ptr<QUICFlowController> fctlr,
                                          const 
std::shared_ptr<QUICCongestionController> cctlr,
                                          const 
std::shared_ptr<QUICLossDetector> ld)
 {
-  connectionManager    = cmgr;
+  this->_connection    = connection;
   streamManager        = smgr;
   flowController       = fctlr;
   congestionController = cctlr;
@@ -79,12 +78,11 @@ QUICFrameDispatcher::receive_frames(const uint8_t *payload, 
uint16_t size)
       break;
     }
     case QUICFrameType::CONNECTION_CLOSE: {
-      connectionManager->handle_frame(frame);
+      this->_connection->handle_frame(frame);
       should_send_ack = true;
       break;
     }
     case QUICFrameType::GOAWAY: {
-      connectionManager->handle_frame(frame);
       should_send_ack = true;
       break;
     }
@@ -103,7 +101,6 @@ QUICFrameDispatcher::receive_frames(const uint8_t *payload, 
uint16_t size)
       break;
     }
     case QUICFrameType::PING: {
-      connectionManager->handle_frame(frame);
       should_send_ack = true;
       break;
     }
diff --git a/iocore/net/quic/QUICFrameDispatcher.h 
b/iocore/net/quic/QUICFrameDispatcher.h
index c16316b..2fd7f34 100644
--- a/iocore/net/quic/QUICFrameDispatcher.h
+++ b/iocore/net/quic/QUICFrameDispatcher.h
@@ -25,16 +25,16 @@
 
 #include "QUICFrame.h"
 
+class QUICConnection;
 class QUICStreamManager;
 class QUICFlowController;
-class QUICConnectionManager;
 class QUICCongestionController;
 class QUICLossDetector;
 
 class QUICFrameDispatcher
 {
 public:
-  QUICFrameDispatcher(const std::shared_ptr<QUICConnectionManager> cmgr, const 
std::shared_ptr<QUICStreamManager> smgr,
+  QUICFrameDispatcher(QUICConnection *connection, const 
std::shared_ptr<QUICStreamManager> smgr,
                       const std::shared_ptr<QUICFlowController> fctlr, const 
std::shared_ptr<QUICCongestionController> cctlr,
                       const std::shared_ptr<QUICLossDetector> ld);
   /*
@@ -42,12 +42,12 @@ public:
    */
   bool receive_frames(const uint8_t *payload, uint16_t size);
 
-  std::shared_ptr<QUICConnectionManager> connectionManager       = nullptr;
   std::shared_ptr<QUICStreamManager> streamManager               = nullptr;
   std::shared_ptr<QUICFlowController> flowController             = nullptr;
   std::shared_ptr<QUICCongestionController> congestionController = nullptr;
   std::shared_ptr<QUICLossDetector> lossDetector                 = nullptr;
 
 private:
+  QUICConnection *_connection = nullptr;
   QUICFrameFactory _frame_factory;
 };
diff --git a/iocore/net/quic/QUICFrameHandler.h 
b/iocore/net/quic/QUICFrameHandler.h
index 6a99bac..d4554fe 100644
--- a/iocore/net/quic/QUICFrameHandler.h
+++ b/iocore/net/quic/QUICFrameHandler.h
@@ -27,5 +27,6 @@
 
 class QUICFrameHandler
 {
+public:
   virtual void handle_frame(std::shared_ptr<const QUICFrame> frame) = 0;
 };
diff --git a/iocore/net/quic/QUICPacket.cc b/iocore/net/quic/QUICPacket.cc
index 8b41218..cb45080 100644
--- a/iocore/net/quic/QUICPacket.cc
+++ b/iocore/net/quic/QUICPacket.cc
@@ -636,8 +636,8 @@ 
QUICPacketFactory::create_server_protected_packet(QUICConnectionId connection_id
   if (this->_crypto->encrypt(cipher_txt.get(), cipher_txt_len, 
max_cipher_txt_len, packet->payload(), packet->payload_size(),
                              packet->packet_number(), ad, ad_len, 
packet->key_phase())) {
     packet->set_protected_payload(std::move(cipher_txt), cipher_txt_len);
-    Debug("quic_packet_factory", "Encrypt Packet, pkt_num: %" PRIu64 ", 
header_len: %zu payload: %zu", packet->packet_number(), ad_len,
-          cipher_txt_len);
+    Debug("quic_packet_factory", "Encrypt Packet, pkt_num: %" PRIu64 ", 
header_len: %zu payload: %zu", packet->packet_number(),
+          ad_len, cipher_txt_len);
     return packet;
   } else {
     Debug("quic_packet_factory", "CRYPTOGRAPHIC Error");
diff --git a/iocore/net/quic/test/Makefile.am b/iocore/net/quic/test/Makefile.am
index 1216cda..5837352 100644
--- a/iocore/net/quic/test/Makefile.am
+++ b/iocore/net/quic/test/Makefile.am
@@ -143,7 +143,6 @@ test_QUICFrameDispatcher_SOURCES = \
   main.cc \
   test_QUICFrameDispatcher.cc \
   ../QUICFrameDispatcher.cc \
-  ../QUICConnectionManager.cc \
   ../QUICStreamManager.cc \
   ../QUICFlowController.cc \
   ../QUICCongestionController.cc \
@@ -210,7 +209,6 @@ test_QUICStream_SOURCES = \
   test_QUICStream.cc \
   ../QUICStream.cc \
   ../QUICFrameDispatcher.cc \
-  ../QUICConnectionManager.cc \
   ../QUICStreamManager.cc \
   ../QUICFlowController.cc \
   ../QUICCongestionController.cc
diff --git a/iocore/net/quic/test/test_QUICFrameDispatcher.cc 
b/iocore/net/quic/test/test_QUICFrameDispatcher.cc
index a406a45..6f5f052 100644
--- a/iocore/net/quic/test/test_QUICFrameDispatcher.cc
+++ b/iocore/net/quic/test/test_QUICFrameDispatcher.cc
@@ -32,15 +32,15 @@ TEST_CASE("QUICFrameHandler", "[quic]")
   uint8_t payload[] = {0x01};
   QUICStreamFrame streamFrame(payload, 1, 0x03, 0);
 
-  auto connectionManager    = std::make_shared<MockQUICConnectionManager>();
+  auto connection           = new MockQUICConnection();
   auto streamManager        = std::make_shared<MockQUICStreamManager>();
   auto flowController       = std::make_shared<MockQUICFlowController>();
   auto congestionController = std::make_shared<MockQUICCongestionController>();
   auto lossDetector         = std::make_shared<MockQUICLossDetector>();
-  QUICFrameDispatcher quicFrameDispatcher(connectionManager, streamManager, 
flowController, congestionController, lossDetector);
+  QUICFrameDispatcher quicFrameDispatcher(connection, streamManager, 
flowController, congestionController, lossDetector);
 
   // Initial state
-  CHECK(connectionManager->getTotalFrameCount() == 0);
+  CHECK(connection->getTotalFrameCount() == 0);
   CHECK(streamManager->getTotalFrameCount() == 0);
   CHECK(flowController->getTotalFrameCount() == 0);
   CHECK(congestionController->getTotalFrameCount() == 0);
@@ -50,7 +50,7 @@ TEST_CASE("QUICFrameHandler", "[quic]")
   size_t len        = 0;
   streamFrame.store(buf, &len);
   quicFrameDispatcher.receive_frames(buf, len);
-  CHECK(connectionManager->getTotalFrameCount() == 0);
+  CHECK(connection->getTotalFrameCount() == 0);
   CHECK(streamManager->getTotalFrameCount() == 1);
   CHECK(flowController->getTotalFrameCount() == 1);
   CHECK(congestionController->getTotalFrameCount() == 1);

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

Reply via email to