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 41a18db2392dbec17d7cf7a3e8c77e2b47f2c7e2
Author: Masaori Koshiba <[email protected]>
AuthorDate: Wed Jun 20 12:22:25 2018 +0900

    Reset CongestionController when QUICNetVC need to discard all transport 
state
---
 iocore/net/QUICNetVConnection.cc            |  2 ++
 iocore/net/quic/QUICCongestionController.cc | 13 +++++++++++--
 iocore/net/quic/QUICLossDetector.cc         | 23 ++++++++++++-----------
 iocore/net/quic/QUICLossDetector.h          |  1 +
 4 files changed, 26 insertions(+), 13 deletions(-)

diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index 8e39676..77f2a77 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -882,6 +882,7 @@ 
QUICNetVConnection::_state_handshake_process_version_negotiation_packet(QUICPack
     this->_stream_manager->reset_send_offset();
     this->_stream_manager->reset_recv_offset();
     this->_loss_detector->reset();
+    this->_congestion_controller->reset();
     SCOPED_MUTEX_LOCK(packet_transmitter_lock, 
this->_packet_transmitter_mutex, this_ethread());
     this->_packet_retransmitter.reset();
 
@@ -921,6 +922,7 @@ 
QUICNetVConnection::_state_handshake_process_retry_packet(QUICPacketUPtr packet)
   // discard all transport state
   this->_stream_manager->reset_send_offset();
   this->_loss_detector->reset();
+  this->_congestion_controller->reset();
   SCOPED_MUTEX_LOCK(packet_transmitter_lock, this->_packet_transmitter_mutex, 
this_ethread());
   this->_packet_retransmitter.reset();
 
diff --git a/iocore/net/quic/QUICCongestionController.cc 
b/iocore/net/quic/QUICCongestionController.cc
index 098809d..70510a8 100644
--- a/iocore/net/quic/QUICCongestionController.cc
+++ b/iocore/net/quic/QUICCongestionController.cc
@@ -46,8 +46,7 @@ 
QUICCongestionController::QUICCongestionController(QUICConnectionInfoProvider *i
   this->_k_minimum_window        = params->cc_minimum_window();
   this->_k_loss_reduction_factor = params->cc_loss_reduction_factor();
 
-  // [draft-11 recovery] 4.7.3.  Initialization
-  this->_congestion_window = this->_k_initial_window;
+  this->reset();
 }
 
 void
@@ -134,3 +133,13 @@ QUICCongestionController::current_ssthresh() const
 {
   return this->_ssthresh;
 }
+
+// [draft-11 recovery] 4.7.3.  Initialization
+void
+QUICCongestionController::reset()
+{
+  this->_bytes_in_flight         = 0;
+  this->_congestion_window       = this->_k_initial_window;;
+  this->_end_of_recovery = 0;
+  this->_ssthresh                = UINT32_MAX;
+}
diff --git a/iocore/net/quic/QUICLossDetector.cc 
b/iocore/net/quic/QUICLossDetector.cc
index 36d6279..327b253 100644
--- a/iocore/net/quic/QUICLossDetector.cc
+++ b/iocore/net/quic/QUICLossDetector.cc
@@ -47,17 +47,7 @@ QUICLossDetector::QUICLossDetector(QUICPacketTransmitter 
*transmitter, QUICConne
   this->_k_delayed_ack_timeout       = params->ld_delayed_ack_timeout();
   this->_k_default_initial_rtt       = params->ld_default_initial_rtt();
 
-  // [draft-11 recovery] 3.5.3.  Initialization
-  if (this->_k_using_time_loss_detection) {
-    this->_reordering_threshold     = UINT32_MAX;
-    this->_time_reordering_fraction = this->_k_time_reordering_fraction;
-  } else {
-    this->_reordering_threshold     = this->_k_reordering_threshold;
-    this->_time_reordering_fraction = INFINITY;
-  }
-
-  this->_handshake_outstanding       = 0;
-  this->_retransmittable_outstanding = 0;
+  this->reset();
 
   SET_HANDLER(&QUICLossDetector::event_handler);
 }
@@ -69,6 +59,8 @@ QUICLossDetector::~QUICLossDetector()
     this->_loss_detection_alarm = nullptr;
   }
 
+  this->_sent_packets.clear();
+
   this->_transmitter = nullptr;
   this->_cc          = nullptr;
 }
@@ -161,8 +153,17 @@ QUICLossDetector::reset()
 
   this->_sent_packets.clear();
 
+  // [draft-11 recovery] 3.5.3.  Initialization
   this->_handshake_outstanding       = 0;
   this->_retransmittable_outstanding = 0;
+
+  if (this->_k_using_time_loss_detection) {
+    this->_reordering_threshold     = UINT32_MAX;
+    this->_time_reordering_fraction = this->_k_time_reordering_fraction;
+  } else {
+    this->_reordering_threshold     = this->_k_reordering_threshold;
+    this->_time_reordering_fraction = INFINITY;
+  }
 }
 
 void
diff --git a/iocore/net/quic/QUICLossDetector.h 
b/iocore/net/quic/QUICLossDetector.h
index 69f811f..023d135 100644
--- a/iocore/net/quic/QUICLossDetector.h
+++ b/iocore/net/quic/QUICLossDetector.h
@@ -65,6 +65,7 @@ public:
   virtual void on_packets_lost(std::map<QUICPacketNumber, PacketInfo *> 
&packets);
   void on_retransmission_timeout_verified();
   bool check_credit() const;
+  void reset();
 
   // Debug
   uint32_t bytes_in_flight() const;

Reply via email to