only allow 1 congestion event per rtt

This commit is contained in:
Green Sky 2023-08-24 01:28:13 +02:00
parent 95b55c3a4a
commit 1c5f4f24a7
No known key found for this signature in database
3 changed files with 15 additions and 8 deletions

View File

@ -33,7 +33,7 @@ struct CCAI {
CCAI(size_t maximum_segment_data_size) : MAXIMUM_SEGMENT_DATA_SIZE(maximum_segment_data_size) {} 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, // 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 // TODO: api for how much data we should send
// take time since last sent into account // take time since last sent into account

View File

@ -112,10 +112,6 @@ void LEDBAT::onLoss(SeqIDType seq, bool discard) {
return; // not found, ignore ?? return; // not found, ignore ??
} }
_recently_lost_data = true;
// at most once per rtt?
if (PLOTTING) { if (PLOTTING) {
std::cerr << "CCA: onLoss: TIME: " << getTimeNow() << "\n"; std::cerr << "CCA: onLoss: TIME: " << getTimeNow() << "\n";
} }
@ -128,7 +124,15 @@ void LEDBAT::onLoss(SeqIDType seq, bool discard) {
} }
// TODO: reset timestamp? // TODO: reset timestamp?
// 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(); updateWindows();
}
} }
float LEDBAT::getCurrentDelay(void) const { float LEDBAT::getCurrentDelay(void) const {

View File

@ -54,7 +54,7 @@ struct LEDBAT : public CCAI{
// return the current believed window in bytes of how much data can be inflight, // return the current believed window in bytes of how much data can be inflight,
// without overstepping the delay requirement // without overstepping the delay requirement
float getCWnD(void) const override { float getCWnD(void) const {
return _cwnd; return _cwnd;
} }
@ -100,9 +100,12 @@ struct LEDBAT : public CCAI{
float _last_cwnd {0.f}; // timepoint of last cwnd correction float _last_cwnd {0.f}; // timepoint of last cwnd correction
int64_t _recently_acked_data {0}; // reset on _last_cwnd int64_t _recently_acked_data {0}; // reset on _last_cwnd
bool _recently_lost_data {false};
int64_t _recently_sent_bytes {0}; 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 // initialize to low value, will get corrected very fast
float _fwnd {0.01f * max_byterate_allowed}; // in bytes float _fwnd {0.01f * max_byterate_allowed}; // in bytes