more fixes

This commit is contained in:
2023-09-01 17:34:05 +02:00
parent a1a9bf886a
commit ba8befbb2d
9 changed files with 37 additions and 61 deletions

View File

@@ -35,16 +35,23 @@ float CUBIC::getCWnD(void) const {
void CUBIC::onCongestion(void) {
if (getTimeNow() - _time_point_reduction >= getCurrentDelay()*4.f) {
const auto current_cwnd = getCWnD();
const auto tmp_old_tp = _time_point_reduction;
_time_point_reduction = getTimeNow();
_window_max = current_cwnd * BETA;
_window_max = std::max(_window_max, 2.*MAXIMUM_SEGMENT_SIZE);
//std::cout << "CONGESTION! cwnd:" << current_cwnd << "\n";
std::cout << "CONGESTION! cwnd_max:" << _window_max << "\n";
#if 1
std::cout << "CONGESTION!"
<< " cwnd_max:" << _window_max
<< " pts:" << tmp_old_tp
<< " rtt:" << getCurrentDelay()
<< "\n"
;
#endif
}
}
size_t CUBIC::canSend(void) {
int64_t CUBIC::canSend(void) {
const auto fspace_pkgs = FlowOnly::canSend();
if (fspace_pkgs == 0u) {
@@ -57,7 +64,7 @@ size_t CUBIC::canSend(void) {
}
// limit to whole packets
size_t cspace_pkgs = std::floor(cspace_bytes / MAXIMUM_SEGMENT_DATA_SIZE) * MAXIMUM_SEGMENT_DATA_SIZE;
int64_t cspace_pkgs = (cspace_bytes / MAXIMUM_SEGMENT_DATA_SIZE) * MAXIMUM_SEGMENT_DATA_SIZE;
return std::min(cspace_pkgs, fspace_pkgs);
}