cubic mostly working (simple), flow rtt seems funky ???

This commit is contained in:
2023-08-30 03:03:43 +02:00
parent d957f9496a
commit 0d49752c3e
6 changed files with 72 additions and 58 deletions

View File

@@ -1,11 +1,11 @@
#pragma once
#include "./cca.hpp"
#include "./flow_only.hpp"
#include <chrono>
struct CUBIC : public CCAI {
using clock = std::chrono::steady_clock;
struct CUBIC : public FlowOnly {
//using clock = std::chrono::steady_clock;
public: // config
static constexpr float BETA {0.7f};
@@ -15,34 +15,22 @@ struct CUBIC : public CCAI {
private:
// window size before last reduciton
double _window_max {2.f * MAXIMUM_SEGMENT_SIZE}; // start with mss*2
double _window_last_max {2.f * MAXIMUM_SEGMENT_SIZE};
double _time_since_reduction {0.};
// initialize to low value, will get corrected very fast
float _fwnd {0.01f * max_byterate_allowed}; // in bytes
// rtt exponental moving average
float _rtt_ema {0.5f};
clock::time_point _time_start_offset;
//double _window_last_max {2.f * MAXIMUM_SEGMENT_SIZE};
double _time_point_reduction {getTimeNow()};
private:
float getCWnD(void) const;
// make values relative to algo start for readability (and precision)
// get timestamp in seconds
double getTimeNow(void) const {
return std::chrono::duration<double>{clock::now() - _time_start_offset}.count();
}
// moving avg over the last few delay samples
// VERY sensitive to bundling acks
float getCurrentDelay(void) const;
//float getCurrentDelay(void) const;
void addRTT(float new_delay);
//void addRTT(float new_delay);
void onCongestion(void) override;
public: // api
CUBIC(size_t maximum_segment_data_size) : CCAI(maximum_segment_data_size) {}
CUBIC(size_t maximum_segment_data_size) : FlowOnly(maximum_segment_data_size) {}
// TODO: api for how much data we should send
// take time since last sent into account
@@ -50,15 +38,15 @@ struct CUBIC : public CCAI {
size_t canSend(void) override;
// get the list of timed out seq_ids
std::vector<SeqIDType> getTimeouts(void) const override;
//std::vector<SeqIDType> getTimeouts(void) const override;
public: // callbacks
// data size is without overhead
void onSent(SeqIDType seq, size_t data_size) override;
//void onSent(SeqIDType seq, size_t data_size) override;
void onAck(std::vector<SeqIDType> seqs) override;
//void onAck(std::vector<SeqIDType> seqs) override;
// if discard, not resent, not inflight
void onLoss(SeqIDType seq, bool discard) override;
//void onLoss(SeqIDType seq, bool discard) override;
};