diff options
author | Mike Perry <mikeperry-git@torproject.org> | 2022-01-21 23:20:52 +0000 |
---|---|---|
committer | Mike Perry <mikeperry-git@torproject.org> | 2022-02-22 19:28:35 +0000 |
commit | d62f9c9d0058ba3bfa8fe226c697abb05a477c5a (patch) | |
tree | f8a8b0e8b8abfe6f8753903bee1182789ce142bc /src | |
parent | 43f6f3fd3a85047fc7fc41e6ce8f924d007b98ee (diff) | |
download | tor-d62f9c9d0058ba3bfa8fe226c697abb05a477c5a.tar.gz tor-d62f9c9d0058ba3bfa8fe226c697abb05a477c5a.zip |
Only apply more frequent cwnd updates after slow start.
Diffstat (limited to 'src')
-rw-r--r-- | src/core/or/congestion_control_st.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/core/or/congestion_control_st.h b/src/core/or/congestion_control_st.h index 0d6bf0b662..ea80868350 100644 --- a/src/core/or/congestion_control_st.h +++ b/src/core/or/congestion_control_st.h @@ -206,7 +206,8 @@ struct congestion_control_t { * * Congestion control literature recommends only one update of cwnd per * cwnd worth of acks. However, we can also tune this to be more frequent - * by increasing the 'cc_cwnd_inc_rate' consensus parameter. + * by increasing the 'cc_cwnd_inc_rate' consensus parameter. This tuning + * only applies after slow start. * * If this returns 0 due to high cwnd_inc_rate, the calling code will * update every sendme ack. @@ -215,8 +216,13 @@ static inline uint64_t CWND_UPDATE_RATE(const struct congestion_control_t *cc) { /* We add cwnd_inc_rate*sendme_inc/2 to round to nearest integer number * of acks */ - return ((cc->cwnd + cc->cwnd_inc_rate*cc->sendme_inc/2) + + if (cc->in_slow_start) { + return ((cc->cwnd + cc->sendme_inc/2)/cc->sendme_inc); + } else { + return ((cc->cwnd + cc->cwnd_inc_rate*cc->sendme_inc/2) / (cc->cwnd_inc_rate*cc->sendme_inc)); + } } /** |