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/03 06:53:09 UTC
[trafficserver] branch quic-latest updated: Fix
QUICLocalFlowContoroller
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
The following commit(s) were added to refs/heads/quic-latest by this push:
new 75a00c5 Fix QUICLocalFlowContoroller
75a00c5 is described below
commit 75a00c564f11e59a5145e1f9a0c1332770fd11bf
Author: Masaori Koshiba <ma...@apache.org>
AuthorDate: Mon Sep 3 15:52:32 2018 +0900
Fix QUICLocalFlowContoroller
---
iocore/net/quic/QUICFlowController.cc | 32 +++++++++++++++++++++-----------
iocore/net/quic/QUICFlowController.h | 20 ++++++++++----------
2 files changed, 31 insertions(+), 21 deletions(-)
diff --git a/iocore/net/quic/QUICFlowController.cc b/iocore/net/quic/QUICFlowController.cc
index 4cbca28..9fddb31 100644
--- a/iocore/net/quic/QUICFlowController.cc
+++ b/iocore/net/quic/QUICFlowController.cc
@@ -88,12 +88,6 @@ QUICFlowController::forward_limit(QUICOffset limit)
}
void
-QUICFlowController::set_threshold(uint64_t threshold)
-{
- this->_threshold = threshold;
-}
-
-void
QUICFlowController::set_limit(QUICOffset limit)
{
ink_assert(this->_limit == UINT64_MAX || this->_limit == limit);
@@ -156,29 +150,45 @@ QUICRemoteFlowController::update(QUICOffset offset)
//
// QUICLocalFlowController
//
+QUICOffset
+QUICLocalFlowController::current_limit() const
+{
+ return this->_advertized_limit;
+}
+
void
QUICLocalFlowController::forward_limit(QUICOffset offset)
{
QUICFlowController::forward_limit(offset);
- // Send MAX_(STREAM_)DATA frame
+ // 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->_frame = this->_create_frame();
+ this->_advertized_limit = this->_limit;
}
}
int
QUICLocalFlowController::update(QUICOffset offset)
{
- this->_analyzer.update(offset);
+ if (this->_offset <= offset) {
+ this->_analyzer.update(offset);
+ }
return QUICFlowController::update(offset);
}
+void
+QUICLocalFlowController::set_limit(QUICOffset limit)
+{
+ this->_advertized_limit = limit;
+ QUICFlowController::set_limit(limit);
+}
+
bool
QUICLocalFlowController::_need_to_gen_frame()
{
- this->_threshold = this->_analyzer.expect_recv_bytes(2 * this->_rtt_provider->smoothed_rtt());
- if (this->_offset + this->_threshold > this->_limit) {
+ QUICOffset threshold = this->_analyzer.expect_recv_bytes(2 * this->_rtt_provider->smoothed_rtt());
+ if (this->_offset + threshold > this->_advertized_limit) {
return true;
}
diff --git a/iocore/net/quic/QUICFlowController.h b/iocore/net/quic/QUICFlowController.h
index 2f36fd9..f849efb 100644
--- a/iocore/net/quic/QUICFlowController.h
+++ b/iocore/net/quic/QUICFlowController.h
@@ -45,7 +45,7 @@ class QUICFlowController : public QUICFrameGenerator
public:
uint64_t credit() const;
QUICOffset current_offset() const;
- QUICOffset current_limit() const;
+ virtual QUICOffset current_limit() const;
/*
* Returns 0 if succeed
@@ -53,13 +53,11 @@ public:
virtual int update(QUICOffset offset);
virtual void forward_limit(QUICOffset limit);
- void set_threshold(uint64_t threshold);
-
/**
* This is only for flow controllers initialized without a limit (== UINT64_MAX).
* Once a limit is set, it should be updated with forward_limit().
*/
- void set_limit(QUICOffset limit);
+ virtual void set_limit(QUICOffset limit);
// QUICFrameGenerator
bool will_generate_frame(QUICEncryptionLevel level) override;
@@ -69,10 +67,9 @@ protected:
QUICFlowController(uint64_t initial_limit) : _limit(initial_limit) {}
virtual QUICFrameUPtr _create_frame() = 0;
- QUICOffset _offset = 0;
- QUICOffset _limit = 0;
- QUICOffset _threshold = 1024;
- QUICFrameUPtr _frame = QUICFrameFactory::create_null_frame();
+ QUICOffset _offset = 0; //< Largest sent/received offset
+ QUICOffset _limit = 0; //< Maximum amount of data to send/receive
+ QUICFrameUPtr _frame = QUICFrameFactory::create_null_frame();
};
class QUICRemoteFlowController : public QUICFlowController
@@ -90,16 +87,19 @@ class QUICLocalFlowController : public QUICFlowController
{
public:
QUICLocalFlowController(QUICRTTProvider *rtt_provider, uint64_t initial_limit)
- : QUICFlowController(initial_limit), _rtt_provider(rtt_provider)
+ : QUICFlowController(initial_limit), _advertized_limit(initial_limit), _rtt_provider(rtt_provider)
{
}
+ QUICOffset current_limit() const override;
void forward_limit(QUICOffset limit) override;
int update(QUICOffset offset) override;
+ void set_limit(QUICOffset limit) override;
private:
bool _need_to_gen_frame();
- QUICRateAnalyzer _analyzer;
+ QUICRateAnalyzer _analyzer;
+ QUICOffset _advertized_limit = 0; //< Advertized limit via MAX(_STREAM)_DATA frame to the remote endpoint
QUICRTTProvider *_rtt_provider = nullptr;
};