accounted

This commit is contained in:
2024-10-31 12:35:32 +01:00
parent 2a0350a564
commit d88c73c761
4 changed files with 36 additions and 2 deletions

View File

@@ -29,6 +29,25 @@ void FlowOnly::updateWindow(void) {
_fwnd = std::max(_fwnd, 2.f * MAXIMUM_SEGMENT_DATA_SIZE);
}
void FlowOnly::updateAccounted(void) {
int64_t size_timedout {0};
{ // can be expensive
// code see getTimeouts()
// after 3 rtt delay, we trigger timeout
const auto now_adjusted = getTimeNow() - getCurrentDelay()*3.f;
for (const auto& [seq, time_stamp, size, _] : _in_flight) {
if (now_adjusted > time_stamp) {
//list.push_back(seq);
size_timedout += size;
}
}
}
_in_flight_bytes_accounted = _in_flight_bytes - size_timedout;
}
void FlowOnly::updateCongestion(void) {
updateWindow();
const auto tmp_window = getWindow();
@@ -70,8 +89,10 @@ int64_t FlowOnly::canSend(float time_delta) {
}
updateWindow();
updateAccounted();
int64_t fspace = _fwnd - _in_flight_bytes;
//int64_t fspace = _fwnd - _in_flight_bytes;
int64_t fspace = _fwnd - _in_flight_bytes_accounted;
if (fspace < MAXIMUM_SEGMENT_DATA_SIZE) {
return 0u;
}
@@ -107,6 +128,10 @@ int64_t FlowOnly::inFlightBytes(void) const {
return _in_flight_bytes;
}
int64_t FlowOnly::inFlightBytesAccounted(void) const {
return _in_flight_bytes_accounted;
}
void FlowOnly::onSent(SeqIDType seq, size_t data_size) {
if constexpr (true) {
size_t sum {0u};