cubic mostly working (simple), flow rtt seems funky ???
This commit is contained in:
@@ -8,7 +8,9 @@ float CUBIC::getCWnD(void) const {
|
||||
(_window_max * (1. - BETA)) / SCALING_CONSTANT
|
||||
);
|
||||
|
||||
const double TK = _time_since_reduction - K;
|
||||
const auto time_since_reduction = getTimeNow() - _time_point_reduction;
|
||||
|
||||
const double TK = time_since_reduction - K;
|
||||
|
||||
const double cwnd =
|
||||
SCALING_CONSTANT
|
||||
@@ -16,34 +18,42 @@ float CUBIC::getCWnD(void) const {
|
||||
+ _window_max
|
||||
;
|
||||
|
||||
std::cout << "K:" << K << " TK:" << TK << " cwnd:" << cwnd << " rtt:" << getCurrentDelay() << "\n";
|
||||
std::cout
|
||||
<< "K:" << K
|
||||
<< " ts:" << time_since_reduction
|
||||
<< " TK:" << TK
|
||||
<< " cwnd:" << cwnd
|
||||
<< " rtt:" << getCurrentDelay()
|
||||
<< "\n"
|
||||
;
|
||||
|
||||
return cwnd;
|
||||
return std::max<float>(cwnd, 2.f * MAXIMUM_SEGMENT_SIZE);
|
||||
}
|
||||
|
||||
float CUBIC::getCurrentDelay(void) const {
|
||||
return _rtt_ema;
|
||||
}
|
||||
void CUBIC::onCongestion(void) {
|
||||
const auto current_cwnd = getCWnD();
|
||||
_time_point_reduction = getTimeNow();
|
||||
_window_max = current_cwnd;
|
||||
|
||||
void CUBIC::addRTT(float new_delay) {
|
||||
// lerp(new_delay, rtt_ema, 0.1)
|
||||
_rtt_ema = RTT_EMA_ALPHA * new_delay + (1.f - RTT_EMA_ALPHA) * _rtt_ema;
|
||||
//std::cout << "CONGESTION!\n";
|
||||
}
|
||||
|
||||
size_t CUBIC::canSend(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::vector<CUBIC::SeqIDType> CUBIC::getTimeouts(void) const {
|
||||
return {};
|
||||
}
|
||||
|
||||
void CUBIC::onSent(SeqIDType seq, size_t data_size) {
|
||||
}
|
||||
|
||||
void CUBIC::onAck(std::vector<SeqIDType> seqs) {
|
||||
}
|
||||
|
||||
void CUBIC::onLoss(SeqIDType seq, bool discard) {
|
||||
const auto flow_space = FlowOnly::canSend();
|
||||
|
||||
if (flow_space == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const int64_t cspace = getCWnD() - _in_flight_bytes;
|
||||
if (cspace < MAXIMUM_SEGMENT_DATA_SIZE) {
|
||||
return 0u;
|
||||
}
|
||||
|
||||
// limit to whole packets
|
||||
size_t space = std::ceil(cspace / MAXIMUM_SEGMENT_DATA_SIZE)
|
||||
* MAXIMUM_SEGMENT_DATA_SIZE;
|
||||
|
||||
return std::min(space, flow_space);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user