update to plugin 7 and refactor (should improve speed)

This commit is contained in:
2024-01-07 17:23:06 +01:00
parent 103f36f2d2
commit f02b03da7c
9 changed files with 37 additions and 19 deletions

View File

@@ -33,7 +33,7 @@ float FlowOnly::getWindow(void) {
return _fwnd;
}
int64_t FlowOnly::canSend(void) {
int64_t FlowOnly::canSend(float time_delta) {
if (_in_flight.empty()) {
assert(_in_flight_bytes == 0);
return MAXIMUM_SEGMENT_DATA_SIZE;
@@ -48,9 +48,7 @@ int64_t FlowOnly::canSend(void) {
// also limit to max sendrate per tick, which is usually smaller than window
// this is mostly to prevent spikes on empty windows
// assuming at most 20ms tick interval
// TODO: pass down actual tick interval
fspace = std::min<int64_t>(fspace, max_byterate_allowed * 0.02f + 0.5f);
fspace = std::min<int64_t>(fspace, max_byterate_allowed * time_delta + 0.5f);
// limit to whole packets
return (fspace / MAXIMUM_SEGMENT_DATA_SIZE) * MAXIMUM_SEGMENT_DATA_SIZE;