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 f48b47bdbf22ce37958bf7b23a7df5be6e5357c6
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Tue Jun 19 14:59:28 2018 +0900

    [draft-11] Add time_of_last_sent_handshake_packet
---
 iocore/net/quic/QUICLossDetector.cc | 17 ++++++++++++-----
 iocore/net/quic/QUICLossDetector.h  | 33 +++++++++++++++++----------------
 2 files changed, 29 insertions(+), 21 deletions(-)

diff --git a/iocore/net/quic/QUICLossDetector.cc 
b/iocore/net/quic/QUICLossDetector.cc
index 89ce1f7..36d6279 100644
--- a/iocore/net/quic/QUICLossDetector.cc
+++ b/iocore/net/quic/QUICLossDetector.cc
@@ -170,14 +170,19 @@ QUICLossDetector::_on_packet_sent(QUICPacketNumber 
packet_number, bool is_ack_on
                                   QUICPacketUPtr packet)
 {
   SCOPED_MUTEX_LOCK(lock, this->_loss_detection_mutex, this_ethread());
-  this->_time_of_last_sent_packet = Thread::get_hrtime();
-  this->_largest_sent_packet      = packet_number;
+  ink_hrtime now             = Thread::get_hrtime();
+  this->_largest_sent_packet = packet_number;
   // FIXME Should we really keep actual packet object?
 
   std::unique_ptr<PacketInfo> packet_info(
-    new PacketInfo({packet_number, this->_time_of_last_sent_packet, 
is_ack_only, is_handshake, sent_bytes, std::move(packet)}));
+    new PacketInfo({packet_number, now, is_ack_only, is_handshake, sent_bytes, 
std::move(packet)}));
   this->_add_to_sent_packet_list(packet_number, std::move(packet_info));
+
   if (!is_ack_only) {
+    if (is_handshake) {
+      this->_time_of_last_sent_handshake_packet = now;
+    }
+    this->_time_of_last_sent_retransmittable_packet = now;
     this->_cc->on_packet_sent(sent_bytes);
     this->_set_loss_detection_alarm();
   }
@@ -293,10 +298,12 @@ QUICLossDetector::_set_loss_detection_alarm()
     }
     alarm_duration = std::max(alarm_duration + this->_max_ack_delay, 
this->_k_min_tlp_timeout);
     alarm_duration = alarm_duration * (1 << this->_handshake_count);
+
+    this->_loss_detection_alarm_at = this->_time_of_last_sent_handshake_packet 
+ alarm_duration;
     QUICLDDebug("Handshake retransmission alarm will be set");
   } else if (this->_loss_time != 0) {
     // Early retransmit timer or time loss detection.
-    alarm_duration = this->_loss_time - this->_time_of_last_sent_packet;
+    alarm_duration = this->_loss_time - 
this->_time_of_last_sent_retransmittable_packet;
     QUICLDDebug("Early retransmit timer or time loss detection will be set");
   } else if (this->_tlp_count < this->_k_max_tlps) {
     // Tail Loss Probe
@@ -321,7 +328,7 @@ QUICLossDetector::_set_loss_detection_alarm()
   if (this->_loss_detection_alarm_at) {
     this->_loss_detection_alarm_at = std::min(this->_loss_detection_alarm_at, 
Thread::get_hrtime() + alarm_duration);
   } else {
-    this->_loss_detection_alarm_at = this->_time_of_last_sent_packet + 
alarm_duration;
+    this->_loss_detection_alarm_at = 
this->_time_of_last_sent_retransmittable_packet + alarm_duration;
   }
   QUICLDDebug("Loss detection alarm has been set to %" PRId64 "ms", 
alarm_duration / HRTIME_MSECOND);
 
diff --git a/iocore/net/quic/QUICLossDetector.h 
b/iocore/net/quic/QUICLossDetector.h
index 156db8c..69f811f 100644
--- a/iocore/net/quic/QUICLossDetector.h
+++ b/iocore/net/quic/QUICLossDetector.h
@@ -124,22 +124,23 @@ private:
 
   // [draft-11 recovery] 3.5.2.  Variables of interest
   // Keep the order as the same as the spec so that we can see the difference 
easily.
-  Action *_loss_detection_alarm        = nullptr;
-  uint32_t _handshake_count            = 0;
-  uint32_t _tlp_count                  = 0;
-  uint32_t _rto_count                  = 0;
-  uint32_t _largest_sent_before_rto    = 0;
-  ink_hrtime _time_of_last_sent_packet = 0;
-  uint32_t _largest_sent_packet        = 0;
-  uint32_t _largest_acked_packet       = 0;
-  ink_hrtime _latest_rtt               = 0;
-  ink_hrtime _smoothed_rtt             = 0;
-  ink_hrtime _rttvar                   = 0;
-  ink_hrtime _min_rtt                  = INT64_MAX;
-  ink_hrtime _max_ack_delay            = 0;
-  uint32_t _reordering_threshold       = 0;
-  double _time_reordering_fraction     = 0.0;
-  ink_hrtime _loss_time                = 0;
+  Action *_loss_detection_alarm                        = nullptr;
+  uint32_t _handshake_count                            = 0;
+  uint32_t _tlp_count                                  = 0;
+  uint32_t _rto_count                                  = 0;
+  uint32_t _largest_sent_before_rto                    = 0;
+  ink_hrtime _time_of_last_sent_retransmittable_packet = 0;
+  ink_hrtime _time_of_last_sent_handshake_packet       = 0;
+  uint32_t _largest_sent_packet                        = 0;
+  uint32_t _largest_acked_packet                       = 0;
+  ink_hrtime _latest_rtt                               = 0;
+  ink_hrtime _smoothed_rtt                             = 0;
+  ink_hrtime _rttvar                                   = 0;
+  ink_hrtime _min_rtt                                  = INT64_MAX;
+  ink_hrtime _max_ack_delay                            = 0;
+  uint32_t _reordering_threshold                       = 0;
+  double _time_reordering_fraction                     = 0.0;
+  ink_hrtime _loss_time                                = 0;
   std::map<QUICPacketNumber, std::unique_ptr<PacketInfo>> _sent_packets;
 
   // These are not defined on the spec but expected to be count

Reply via email to