You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ma...@apache.org on 2017/12/04 08:38:51 UTC

[trafficserver] branch quic-latest updated: Reduce number of events for loss detection

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 d481634  Reduce number of events for loss detection
d481634 is described below

commit d481634760331f8206ef8aa09fe9046fb04134f0
Author: Masakazu Kitajo <ma...@apache.org>
AuthorDate: Mon Dec 4 17:38:13 2017 +0900

    Reduce number of events for loss detection
---
 iocore/net/quic/QUICLossDetector.cc | 14 +++++++++-----
 iocore/net/quic/QUICLossDetector.h  |  6 ++++++
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/iocore/net/quic/QUICLossDetector.cc b/iocore/net/quic/QUICLossDetector.cc
index 41bb3fc..7466d56 100644
--- a/iocore/net/quic/QUICLossDetector.cc
+++ b/iocore/net/quic/QUICLossDetector.cc
@@ -48,7 +48,9 @@ QUICLossDetector::event_handler(int event, Event *edata)
 {
   switch (event) {
   case EVENT_INTERVAL: {
-    this->_on_loss_detection_alarm();
+    if (this->_loss_detection_alarm_at <= Thread::get_hrtime()) {
+      this->_on_loss_detection_alarm();
+    }
     break;
   }
   case QUIC_EVENT_LD_SHUTDOWN: {
@@ -278,6 +280,7 @@ QUICLossDetector::_set_loss_detection_alarm()
 {
   ink_hrtime alarm_duration;
   if (!this->_retransmittable_outstanding && this->_loss_detection_alarm) {
+    this->_loss_detection_alarm_at = 0;
     this->_loss_detection_alarm->cancel();
     this->_loss_detection_alarm = nullptr;
     DebugQUICLD("Loss detection alarm has been unset");
@@ -314,11 +317,12 @@ QUICLossDetector::_set_loss_detection_alarm()
     DebugQUICLD("RTO alarm will be set");
   }
 
-  if (this->_loss_detection_alarm) {
-    this->_loss_detection_alarm->cancel();
-  }
-  this->_loss_detection_alarm = eventProcessor.schedule_in(this, alarm_duration);
+  this->_loss_detection_alarm_at = Thread::get_hrtime() + alarm_duration;
   DebugQUICLD("Loss detection alarm has been set to %" PRId64, alarm_duration);
+
+  if (!this->_loss_detection_alarm) {
+    this->_loss_detection_alarm = eventProcessor.schedule_every(this, HRTIME_MSECONDS(100));
+  }
 }
 
 std::set<QUICPacketNumber>
diff --git a/iocore/net/quic/QUICLossDetector.h b/iocore/net/quic/QUICLossDetector.h
index a899f99..16e5c64 100644
--- a/iocore/net/quic/QUICLossDetector.h
+++ b/iocore/net/quic/QUICLossDetector.h
@@ -96,6 +96,12 @@ private:
   uint32_t _retransmittable_outstanding = 0;
   void _decrement_packet_count(QUICPacketNumber packet_number);
 
+  /*
+   * Because this alarm will be reset on every packet transmission, to reduce number of events,
+   * Loss Detector uses schedule_every() and checks if it has to be triggered.
+   */
+  ink_hrtime _loss_detection_alarm_at = 0;
+
   void _on_packet_sent(QUICPacketNumber packet_number, bool is_retransmittable, bool is_handshake, size_t sent_bytes,
                        QUICPacketUPtr packet);
   void _on_ack_received(const std::shared_ptr<const QUICAckFrame> &ack_frame);

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