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: Use ink_hrtime internally for RTT calculation
Date Wed, 06 Dec 2017 06:37:52 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 a300d3a  Use ink_hrtime internally for RTT calculation
a300d3a is described below

commit a300d3a828916ce1ec8b6bf5ee818ce4a327bc28
Author: Masakazu Kitajo <maskit@apache.org>
AuthorDate: Wed Dec 6 15:37:00 2017 +0900

    Use ink_hrtime internally for RTT calculation
---
 iocore/net/quic/QUICLossDetector.cc | 14 ++++++++------
 iocore/net/quic/QUICLossDetector.h  |  4 ++--
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/iocore/net/quic/QUICLossDetector.cc b/iocore/net/quic/QUICLossDetector.cc
index 672679b..ec3f452 100644
--- a/iocore/net/quic/QUICLossDetector.cc
+++ b/iocore/net/quic/QUICLossDetector.cc
@@ -189,8 +189,9 @@ QUICLossDetector::_on_ack_received(const std::shared_ptr<const QUICAckFrame>
&ac
   auto pi = this->_sent_packets.find(ack_frame->largest_acknowledged());
   if (pi != this->_sent_packets.end()) {
     this->_latest_rtt = Thread::get_hrtime() - pi->second->time;
-    if (this->_latest_rtt > ack_frame->ack_delay()) {
-      this->_latest_rtt -= ack_frame->ack_delay();
+    // _latest_rtt is nanosecond but ack_frame->ack_delay is millisecond
+    if (this->_latest_rtt > HRTIME_MSECONDS(ack_frame->ack_delay())) {
+      this->_latest_rtt -= HRTIME_MSECONDS(ack_frame->ack_delay());
     }
     this->_update_rtt(this->_latest_rtt);
   }
@@ -248,22 +249,23 @@ QUICLossDetector::_on_loss_detection_alarm()
     this->_detect_lost_packets(this->_largest_acked_packet);
   } else if (this->_tlp_count < this->_MAX_TLPS) {
     // Tail Loss Probe.
-    // eventProcessor.schedule_imm(this->_handler, ET_CALL, QUIC_EVENT_RETRANSMIT_ONE_PACKET);
+    this->_send_one_packet();
     this->_tlp_count++;
   } else {
     // RTO.
     if (this->_rto_count == 0) {
       this->_largest_sent_before_rto = this->_largest_sent_packet;
     }
-    // eventProcessor.schedule_imm(this->_handler, ET_CALL, QUIC_EVENT_RETRANSMIT_TWO_PACKET);
+    this->_send_two_packets();
     this->_rto_count++;
   }
-  QUICLDDebug("Unacked handshake pkt %u, retransmittable pkt %u", this->_handshake_outstanding,
this->_retransmittable_outstanding);
+  QUICLDDebug("Unacked packets %lu (handshake pkt %u, retransmittable pkt %u)", this->_sent_packets.size(),
+              this->_handshake_outstanding.load(), this->_retransmittable_outstanding.load());
   this->_set_loss_detection_alarm();
 }
 
 void
-QUICLossDetector::_update_rtt(uint32_t latest_rtt)
+QUICLossDetector::_update_rtt(ink_hrtime latest_rtt)
 {
   // Based on {{RFC6298}}.
   if (this->_smoothed_rtt == 0) {
diff --git a/iocore/net/quic/QUICLossDetector.h b/iocore/net/quic/QUICLossDetector.h
index 16e5c64..3c4d0fd 100644
--- a/iocore/net/quic/QUICLossDetector.h
+++ b/iocore/net/quic/QUICLossDetector.h
@@ -86,7 +86,7 @@ private:
   uint32_t _time_of_last_sent_packet = 0;
   ink_hrtime _latest_rtt             = 0;
   ink_hrtime _smoothed_rtt           = 0;
-  uint32_t _rttvar                   = 0;
+  ink_hrtime _rttvar                 = 0;
   uint32_t _reordering_threshold;
   double _time_reordering_fraction;
   ink_hrtime _loss_time = 0;
@@ -106,7 +106,7 @@ private:
                        QUICPacketUPtr packet);
   void _on_ack_received(const std::shared_ptr<const QUICAckFrame> &ack_frame);
   void _on_packet_acked(QUICPacketNumber acked_packet_number);
-  void _update_rtt(uint32_t latest_rtt);
+  void _update_rtt(ink_hrtime latest_rtt);
   void _detect_lost_packets(QUICPacketNumber largest_acked);
   void _set_loss_detection_alarm();
   void _on_loss_detection_alarm();

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

Mime
View raw message