additional time slicing for flow

This commit is contained in:
Green Sky
2025-12-13 13:33:42 +01:00
parent 404669eb7e
commit 308790dc3a
2 changed files with 11 additions and 1 deletions

View File

@@ -102,6 +102,8 @@ int64_t CUBIC::canSend(float time_delta) {
// this is mostly to prevent spikes on empty windows
const auto rate = window / getCurrentDelay();
// TODO: time slicing alla flow
// we dont want this limit to fall below atleast 1 segment
const int64_t max_bytes_per_tick = std::max<int64_t>(rate * time_delta + 0.5f, MAXIMUM_SEGMENT_SIZE);
cspace_bytes = std::min<int64_t>(cspace_bytes, max_bytes_per_tick);

View File

@@ -80,7 +80,15 @@ int64_t FlowOnly::canSend(float time_delta) {
// also limit to max sendrate per tick, which is usually smaller than window
// this is mostly to prevent spikes on empty windows
fspace = std::min<int64_t>(fspace, max_byterate_allowed * time_delta + 0.5f);
fspace = std::min<int64_t>({
fspace,
// slice window into time time_delta sized chunks and only allow 1.5 chunks sized per tick
int64_t((1.5f * _fwnd) / time_delta + 0.5f),
// similar, but without current delay in the equation (fallback)
int64_t(1.2f * max_byterate_allowed * time_delta + 0.5f),
});
// limit to whole packets
return (fspace / MAXIMUM_SEGMENT_DATA_SIZE) * MAXIMUM_SEGMENT_DATA_SIZE;