summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Perry <mikeperry-git@torproject.org>2022-12-21 01:18:28 +0000
committerDavid Goulet <dgoulet@torproject.org>2023-01-10 11:56:21 -0500
commitf4499bb5e27a96e1558f99edb081de473c13c7a6 (patch)
treee67a3eeb9de55bc06f247af23ca9a774b85499ee
parent48de1a392e0694662944cbeb91d96efed6b8c38e (diff)
downloadtor-f4499bb5e27a96e1558f99edb081de473c13c7a6.tar.gz
tor-f4499bb5e27a96e1558f99edb081de473c13c7a6.zip
Clean up next_cc_event handling.
-rw-r--r--src/core/or/congestion_control_st.h2
-rw-r--r--src/core/or/congestion_control_vegas.c14
2 files changed, 6 insertions, 10 deletions
diff --git a/src/core/or/congestion_control_st.h b/src/core/or/congestion_control_st.h
index 3fe693d989..08bf70f73b 100644
--- a/src/core/or/congestion_control_st.h
+++ b/src/core/or/congestion_control_st.h
@@ -231,7 +231,7 @@ static inline uint64_t CWND_UPDATE_RATE(const struct congestion_control_t *cc)
* of acks */
if (cc->in_slow_start) {
- return ((cc->cwnd + cc->sendme_inc/2)/cc->sendme_inc);
+ return 1;
} else {
return ((cc->cwnd + cc->cwnd_inc_rate*cc->sendme_inc/2)
/ (cc->cwnd_inc_rate*cc->sendme_inc));
diff --git a/src/core/or/congestion_control_vegas.c b/src/core/or/congestion_control_vegas.c
index 044689421e..ae945e7e00 100644
--- a/src/core/or/congestion_control_vegas.c
+++ b/src/core/or/congestion_control_vegas.c
@@ -301,7 +301,6 @@ congestion_control_vegas_exit_slow_start(const circuit_t *circ,
{
congestion_control_vegas_log(circ, cc);
cc->in_slow_start = 0;
- cc->next_cc_event = CWND_UPDATE_RATE(cc);
congestion_control_vegas_log(circ, cc);
/* Update metricsport metrics */
@@ -445,11 +444,11 @@ congestion_control_vegas_process_sendme(congestion_control_t *cc,
if (cc->cwnd_full) {
/* Get the "Limited Slow Start" increment */
uint64_t inc = rfc3742_ss_inc(cc);
+ cc->cwnd += inc;
// Check if inc is less than what we would do in steady-state
// avoidance
if (inc*SENDME_PER_CWND(cc) <= CWND_INC(cc)) {
- cc->cwnd += inc;
congestion_control_vegas_exit_slow_start(circ, cc);
cc_stats_vegas_below_ss_inc_floor++;
@@ -458,9 +457,6 @@ congestion_control_vegas_process_sendme(congestion_control_t *cc,
cc_stats_vegas_ss_csig_blocked_ma =
stats_update_running_avg(cc_stats_vegas_ss_csig_blocked_ma,
0);
- } else {
- cc->cwnd += inc;
- cc->next_cc_event = 1; // Technically irellevant, but for consistency
}
}
} else {
@@ -581,9 +577,6 @@ congestion_control_vegas_process_sendme(congestion_control_t *cc,
/* cwnd can never fall below 1 increment */
cc->cwnd = MAX(cc->cwnd, cc->cwnd_min);
- /* Schedule next update */
- cc->next_cc_event = CWND_UPDATE_RATE(cc);
-
congestion_control_vegas_log(circ, cc);
/* Update metrics */
@@ -602,10 +595,13 @@ congestion_control_vegas_process_sendme(congestion_control_t *cc,
}
}
- /* Once per cwnd, reset the cwnd full state */
+ /* Reset event counters */
if (cc->next_cwnd_event == 0) {
cc->next_cwnd_event = SENDME_PER_CWND(cc);
}
+ if (cc->next_cc_event == 0) {
+ cc->next_cc_event = CWND_UPDATE_RATE(cc);
+ }
/* Decide if enough time has passed to reset the cwnd utilization */
if (cwnd_full_reset(cc))