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 2018/09/04 02:53:03 UTC

[trafficserver] 02/03: Cleanup: Remove _advertized_limit from QUICLocalFlowController

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 5e65a99094e4a921466236dd0de90768b5b6d361
Author: Masaori Koshiba <ma...@apache.org>
AuthorDate: Tue Sep 4 11:34:45 2018 +0900

    Cleanup: Remove _advertized_limit from QUICLocalFlowController
---
 iocore/net/quic/QUICFlowController.cc | 21 +++++++++------------
 iocore/net/quic/QUICFlowController.h  | 13 ++++++++-----
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/iocore/net/quic/QUICFlowController.cc b/iocore/net/quic/QUICFlowController.cc
index 9fddb31..b7d738e 100644
--- a/iocore/net/quic/QUICFlowController.cc
+++ b/iocore/net/quic/QUICFlowController.cc
@@ -126,9 +126,9 @@ QUICFlowController::generate_frame(QUICEncryptionLevel level, uint64_t connectio
 // QUICRemoteFlowController
 //
 void
-QUICRemoteFlowController::forward_limit(QUICOffset offset)
+QUICRemoteFlowController::forward_limit(QUICOffset new_limit)
 {
-  QUICFlowController::forward_limit(offset);
+  QUICFlowController::forward_limit(new_limit);
   this->_blocked = false;
 }
 
@@ -153,18 +153,16 @@ QUICRemoteFlowController::update(QUICOffset offset)
 QUICOffset
 QUICLocalFlowController::current_limit() const
 {
-  return this->_advertized_limit;
+  return this->_limit;
 }
 
 void
-QUICLocalFlowController::forward_limit(QUICOffset offset)
+QUICLocalFlowController::forward_limit(QUICOffset new_limit)
 {
-  QUICFlowController::forward_limit(offset);
-
   // Create MAX_(STREAM_)DATA frame. The frame will be sent on next WRITE_READY event on QUICNetVC
-  if (this->_need_to_gen_frame()) {
-    this->_frame            = this->_create_frame();
-    this->_advertized_limit = this->_limit;
+  if (this->_need_to_forward_limit()) {
+    QUICFlowController::forward_limit(new_limit);
+    this->_frame = this->_create_frame();
   }
 }
 
@@ -180,15 +178,14 @@ QUICLocalFlowController::update(QUICOffset offset)
 void
 QUICLocalFlowController::set_limit(QUICOffset limit)
 {
-  this->_advertized_limit = limit;
   QUICFlowController::set_limit(limit);
 }
 
 bool
-QUICLocalFlowController::_need_to_gen_frame()
+QUICLocalFlowController::_need_to_forward_limit()
 {
   QUICOffset threshold = this->_analyzer.expect_recv_bytes(2 * this->_rtt_provider->smoothed_rtt());
-  if (this->_offset + threshold > this->_advertized_limit) {
+  if (this->_offset + threshold >= this->_limit) {
     return true;
   }
 
diff --git a/iocore/net/quic/QUICFlowController.h b/iocore/net/quic/QUICFlowController.h
index f849efb..4461a73 100644
--- a/iocore/net/quic/QUICFlowController.h
+++ b/iocore/net/quic/QUICFlowController.h
@@ -77,7 +77,7 @@ class QUICRemoteFlowController : public QUICFlowController
 public:
   QUICRemoteFlowController(uint64_t initial_limit) : QUICFlowController(initial_limit) {}
   int update(QUICOffset offset) override;
-  void forward_limit(QUICOffset limit) override;
+  void forward_limit(QUICOffset new_limit) override;
 
 private:
   bool _blocked = false;
@@ -87,19 +87,22 @@ class QUICLocalFlowController : public QUICFlowController
 {
 public:
   QUICLocalFlowController(QUICRTTProvider *rtt_provider, uint64_t initial_limit)
-    : QUICFlowController(initial_limit), _advertized_limit(initial_limit), _rtt_provider(rtt_provider)
+    : QUICFlowController(initial_limit), _rtt_provider(rtt_provider)
   {
   }
   QUICOffset current_limit() const override;
-  void forward_limit(QUICOffset limit) override;
+
+  /**
+   * Unlike QUICRemoteFlowController::forward_limit(), this function forwards limit if needed.
+   */
+  void forward_limit(QUICOffset new_limit) override;
   int update(QUICOffset offset) override;
   void set_limit(QUICOffset limit) override;
 
 private:
-  bool _need_to_gen_frame();
+  bool _need_to_forward_limit();
 
   QUICRateAnalyzer _analyzer;
-  QUICOffset _advertized_limit   = 0; //< Advertized limit via MAX(_STREAM)_DATA frame to the remote endpoint
   QUICRTTProvider *_rtt_provider = nullptr;
 };