mirror of
https://github.com/Green-Sky/tox_ngc_ft1.git
synced 2024-12-23 02:53:24 +01:00
ledbat tweaks
This commit is contained in:
parent
95bfa2473c
commit
304aae05c2
17
ledbat.cpp
17
ledbat.cpp
@ -187,18 +187,18 @@ void LEDBAT::updateWindows(void) {
|
|||||||
if (now - _last_cwnd >= current_delay) {
|
if (now - _last_cwnd >= current_delay) {
|
||||||
const float queuing_delay {current_delay - _base_delay};
|
const float queuing_delay {current_delay - _base_delay};
|
||||||
|
|
||||||
_fwnd = max_byterate_allowed * getCurrentDelay();
|
_fwnd = max_byterate_allowed * current_delay;
|
||||||
_fwnd *= 1.3f; // try do balance conservative algo a bit, current_delay
|
_fwnd *= 1.3f; // try do balance conservative algo a bit, current_delay
|
||||||
|
|
||||||
//const float gain {1}; // TODO: move and increase
|
|
||||||
float gain {1.f / std::min(16.f, std::ceil(2.f*target_delay/_base_delay))};
|
float gain {1.f / std::min(16.f, std::ceil(2.f*target_delay/_base_delay))};
|
||||||
//gain *= 400.f; // from packets to bytes ~
|
//gain *= 400.f; // from packets to bytes ~
|
||||||
gain *= _recently_acked_data/10.f; // from packets to bytes ~
|
gain *= _recently_acked_data/5.f; // from packets to bytes ~
|
||||||
//gain *= 0.1f;
|
//gain *= 0.1f;
|
||||||
|
|
||||||
if (_recently_lost_data) {
|
if (_recently_lost_data) {
|
||||||
_cwnd = std::clamp(
|
_cwnd = std::clamp(
|
||||||
_cwnd / 2.f,
|
//_cwnd / 2.f,
|
||||||
|
_cwnd / 1.6f,
|
||||||
2.f * maximum_segment_size,
|
2.f * maximum_segment_size,
|
||||||
_cwnd
|
_cwnd
|
||||||
);
|
);
|
||||||
@ -207,23 +207,22 @@ void LEDBAT::updateWindows(void) {
|
|||||||
// "Multiplicative decrease"
|
// "Multiplicative decrease"
|
||||||
const float constant {2.f}; // spec recs 1
|
const float constant {2.f}; // spec recs 1
|
||||||
if (queuing_delay < target_delay) {
|
if (queuing_delay < target_delay) {
|
||||||
_cwnd += gain;
|
|
||||||
_cwnd = std::min(
|
_cwnd = std::min(
|
||||||
_cwnd + gain,
|
_cwnd + gain,
|
||||||
_fwnd
|
_fwnd
|
||||||
);
|
);
|
||||||
} else if (queuing_delay > target_delay) {
|
} else if (queuing_delay > target_delay) {
|
||||||
_cwnd = std::clamp(
|
_cwnd = std::clamp(
|
||||||
_cwnd + std::max( // TODO: where to put bytes_newly_acked
|
_cwnd + std::max(
|
||||||
gain - constant * _cwnd * (queuing_delay / target_delay - 1.f),
|
gain - constant * _cwnd * (queuing_delay / target_delay - 1.f),
|
||||||
-_cwnd/2.f // at most halve
|
-_cwnd/2.f // at most halve
|
||||||
),
|
),
|
||||||
|
|
||||||
// never drop below 2 "packets" in flight
|
// never drop below 2 "packets" in flight
|
||||||
//2.f * maximum_segment_size,
|
2.f * maximum_segment_size,
|
||||||
2.f * 496,
|
|
||||||
|
|
||||||
current_delay * max_byterate_allowed // cap rate
|
// cap rate
|
||||||
|
_fwnd
|
||||||
);
|
);
|
||||||
} // no else, we on point. very unlikely with float
|
} // no else, we on point. very unlikely with float
|
||||||
}
|
}
|
||||||
|
@ -29,8 +29,8 @@ struct LEDBAT {
|
|||||||
static_assert(maximum_segment_size == 574); // mesured in wireshark
|
static_assert(maximum_segment_size == 574); // mesured in wireshark
|
||||||
|
|
||||||
// ledbat++ says 60ms, we might need other values if relayed
|
// ledbat++ says 60ms, we might need other values if relayed
|
||||||
//const float target_delay {0.060f};
|
const float target_delay {0.060f};
|
||||||
const float target_delay {0.030f};
|
//const float target_delay {0.030f};
|
||||||
//const float target_delay {0.120f}; // 2x if relayed?
|
//const float target_delay {0.120f}; // 2x if relayed?
|
||||||
|
|
||||||
// TODO: use a factor for multiple of rtt
|
// TODO: use a factor for multiple of rtt
|
||||||
@ -38,8 +38,7 @@ struct LEDBAT {
|
|||||||
|
|
||||||
//static constexpr size_t rtt_buffer_size_max {2000};
|
//static constexpr size_t rtt_buffer_size_max {2000};
|
||||||
|
|
||||||
//float max_byterate_allowed {10*1024*1024}; // 10MiB/s
|
float max_byterate_allowed {10*1024*1024}; // 10MiB/s
|
||||||
float max_byterate_allowed {1*1024*1024};
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LEDBAT(void);
|
LEDBAT(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user