something here broke it

- accounting for rounded down bytes
This commit is contained in:
Green Sky 2024-05-27 20:51:42 +02:00
parent 1231e792a7
commit 1df724f62f
No known key found for this signature in database
3 changed files with 5 additions and 3 deletions

View File

@ -51,6 +51,7 @@ void CUBIC::onCongestion(void) {
const auto current_cwnd = getCWnD(); // TODO: remove, only used by logging? const auto current_cwnd = getCWnD(); // TODO: remove, only used by logging?
const auto current_wnd = getWindow(); // respects cwnd and fwnd const auto current_wnd = getWindow(); // respects cwnd and fwnd
_bytes_leftover = 0;
resetReductionTimer(); resetReductionTimer();
if (current_cwnd < _window_max) { if (current_cwnd < _window_max) {
@ -90,7 +91,7 @@ int64_t CUBIC::canSend(float time_delta) {
} }
const auto window = getCWnD(); const auto window = getCWnD();
int64_t cspace_bytes = window - _in_flight_bytes; int64_t cspace_bytes = (window - _in_flight_bytes) + _bytes_leftover;
if (cspace_bytes < MAXIMUM_SEGMENT_DATA_SIZE) { if (cspace_bytes < MAXIMUM_SEGMENT_DATA_SIZE) {
return 0u; return 0u;
} }
@ -106,6 +107,8 @@ int64_t CUBIC::canSend(float time_delta) {
// limit to whole packets // limit to whole packets
int64_t cspace_pkgs = (cspace_bytes / MAXIMUM_SEGMENT_DATA_SIZE) * MAXIMUM_SEGMENT_DATA_SIZE; int64_t cspace_pkgs = (cspace_bytes / MAXIMUM_SEGMENT_DATA_SIZE) * MAXIMUM_SEGMENT_DATA_SIZE;
_bytes_leftover = cspace_bytes - cspace_pkgs;
return std::min(cspace_pkgs, fspace_pkgs); return std::min(cspace_pkgs, fspace_pkgs);
} }

View File

@ -19,6 +19,7 @@ struct CUBIC : public FlowOnly {
//double _window_last_max {2.f * MAXIMUM_SEGMENT_SIZE}; //double _window_last_max {2.f * MAXIMUM_SEGMENT_SIZE};
double _time_since_reduction {12.f}; // warm start double _time_since_reduction {12.f}; // warm start
int64_t _bytes_leftover {0};
private: private:
void updateReductionTimer(float time_delta); void updateReductionTimer(float time_delta);

View File

@ -114,8 +114,6 @@ void FlowOnly::onSent(SeqIDType seq, size_t data_size) {
); );
_in_flight_bytes += data_size + SEGMENT_OVERHEAD; _in_flight_bytes += data_size + SEGMENT_OVERHEAD;
//_recently_sent_bytes += data_size + SEGMENT_OVERHEAD; //_recently_sent_bytes += data_size + SEGMENT_OVERHEAD;
_time_point_last_update = getTimeNow();
} }
void FlowOnly::onAck(std::vector<SeqIDType> seqs) { void FlowOnly::onAck(std::vector<SeqIDType> seqs) {