diff --git a/solanaceae/ngc_ft1/cubic.cpp b/solanaceae/ngc_ft1/cubic.cpp index 82e3544..8f2e972 100644 --- a/solanaceae/ngc_ft1/cubic.cpp +++ b/solanaceae/ngc_ft1/cubic.cpp @@ -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(rate * time_delta + 0.5f, MAXIMUM_SEGMENT_SIZE); cspace_bytes = std::min(cspace_bytes, max_bytes_per_tick); diff --git a/solanaceae/ngc_ft1/flow_only.cpp b/solanaceae/ngc_ft1/flow_only.cpp index 3ed73f5..c7f72bc 100644 --- a/solanaceae/ngc_ft1/flow_only.cpp +++ b/solanaceae/ngc_ft1/flow_only.cpp @@ -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(fspace, max_byterate_allowed * time_delta + 0.5f); + fspace = std::min({ + 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;