[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor] 02/15: Clean up next_cc_event handling.



This is an automated email from the git hooks/post-receive script.

dgoulet pushed a commit to branch main
in repository tor.

commit 967ae3ab0e31abc259b3213d99a6c02082ad0ae8
Author: Mike Perry <mikeperry-git@xxxxxxxxxxxxxx>
AuthorDate: Wed Dec 21 01:18:28 2022 +0000

    Clean up next_cc_event handling.
---
 src/core/or/congestion_control_st.h    |  2 +-
 src/core/or/congestion_control_vegas.c | 14 +++++---------
 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))

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits