From 1c5f4f24a799d78da0a29f83c789a80256fe677a Mon Sep 17 00:00:00 2001 From: Green Sky Date: Thu, 24 Aug 2023 01:28:13 +0200 Subject: [PATCH] only allow 1 congestion event per rtt --- solanaceae/ngc_ft1/cca.hpp | 2 +- solanaceae/ngc_ft1/ledbat.cpp | 14 +++++++++----- solanaceae/ngc_ft1/ledbat.hpp | 7 +++++-- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/solanaceae/ngc_ft1/cca.hpp b/solanaceae/ngc_ft1/cca.hpp index aa017bf..37d8509 100644 --- a/solanaceae/ngc_ft1/cca.hpp +++ b/solanaceae/ngc_ft1/cca.hpp @@ -33,7 +33,7 @@ struct CCAI { CCAI(size_t maximum_segment_data_size) : MAXIMUM_SEGMENT_DATA_SIZE(maximum_segment_data_size) {} // return the current believed window in bytes of how much data can be inflight, - virtual float getCWnD(void) const = 0; + //virtual float getCWnD(void) const = 0; // TODO: api for how much data we should send // take time since last sent into account diff --git a/solanaceae/ngc_ft1/ledbat.cpp b/solanaceae/ngc_ft1/ledbat.cpp index 49e8580..c20a511 100644 --- a/solanaceae/ngc_ft1/ledbat.cpp +++ b/solanaceae/ngc_ft1/ledbat.cpp @@ -112,10 +112,6 @@ void LEDBAT::onLoss(SeqIDType seq, bool discard) { return; // not found, ignore ?? } - _recently_lost_data = true; - - // at most once per rtt? - if (PLOTTING) { std::cerr << "CCA: onLoss: TIME: " << getTimeNow() << "\n"; } @@ -128,7 +124,15 @@ void LEDBAT::onLoss(SeqIDType seq, bool discard) { } // TODO: reset timestamp? - updateWindows(); + // at most once per rtt? + // TODO: use delay at event instead + if (getTimeNow() >= _last_congestion_event + _last_congestion_rtt) { + _recently_lost_data = true; + _last_congestion_event = getTimeNow(); + _last_congestion_rtt = getCurrentDelay(); + + updateWindows(); + } } float LEDBAT::getCurrentDelay(void) const { diff --git a/solanaceae/ngc_ft1/ledbat.hpp b/solanaceae/ngc_ft1/ledbat.hpp index 6113550..b023f92 100644 --- a/solanaceae/ngc_ft1/ledbat.hpp +++ b/solanaceae/ngc_ft1/ledbat.hpp @@ -54,7 +54,7 @@ struct LEDBAT : public CCAI{ // return the current believed window in bytes of how much data can be inflight, // without overstepping the delay requirement - float getCWnD(void) const override { + float getCWnD(void) const { return _cwnd; } @@ -100,9 +100,12 @@ struct LEDBAT : public CCAI{ float _last_cwnd {0.f}; // timepoint of last cwnd correction int64_t _recently_acked_data {0}; // reset on _last_cwnd - bool _recently_lost_data {false}; int64_t _recently_sent_bytes {0}; + bool _recently_lost_data {false}; + float _last_congestion_event {0.f}; + float _last_congestion_rtt {0.5f}; + // initialize to low value, will get corrected very fast float _fwnd {0.01f * max_byterate_allowed}; // in bytes