aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Perry <mikeperry-git@torproject.org>2022-03-03 20:41:27 +0000
committerMike Perry <mikeperry-git@torproject.org>2022-03-03 20:55:46 +0000
commit7cb050bd7dcc98854d25641c12d20cae549d61e9 (patch)
tree0b88a5ccf7fae5086641255bb8df7e0f798da288 /src
parent646a1d5f9ae481667f0ec43e45879b94ea2dd28a (diff)
downloadtor-7cb050bd7dcc98854d25641c12d20cae549d61e9.tar.gz
tor-7cb050bd7dcc98854d25641c12d20cae549d61e9.zip
Ensure CIRC_BW event is emitted immediately upon slow start exit.
This ensures sbws gets this information quickly, so it can begin measurement.
Diffstat (limited to 'src')
-rw-r--r--src/core/or/congestion_control_nola.c16
-rw-r--r--src/core/or/congestion_control_vegas.c9
-rw-r--r--src/core/or/congestion_control_westwood.c9
3 files changed, 32 insertions, 2 deletions
diff --git a/src/core/or/congestion_control_nola.c b/src/core/or/congestion_control_nola.c
index 52d41157a2..0c64793d91 100644
--- a/src/core/or/congestion_control_nola.c
+++ b/src/core/or/congestion_control_nola.c
@@ -22,6 +22,7 @@
#include "core/or/origin_circuit_st.h"
#include "core/or/channel.h"
#include "feature/nodelist/networkstatus.h"
+#include "feature/control/control_events.h"
#define NOLA_BDP_OVERSHOOT 100
@@ -70,8 +71,19 @@ congestion_control_nola_process_sendme(congestion_control_t *cc,
/* If we get a congestion event, the only thing NOLA
* does is note this as if we exited slow-start
* (which for NOLA just means we finished our ICW). */
- if (cc->next_cc_event == 0)
- cc->in_slow_start = 0;
+ if (cc->next_cc_event == 0) {
+ if (cc->in_slow_start) {
+ cc->in_slow_start = 0;
+
+ /* We need to report that slow start has exited ASAP,
+ * for sbws bandwidth measurement. */
+ if (CIRCUIT_IS_ORIGIN(circ)) {
+ /* We must discard const here because the event modifies fields :/ */
+ control_event_circ_bandwidth_used_for_circ(
+ TO_ORIGIN_CIRCUIT((circuit_t*)circ));
+ }
+ }
+ }
/* If we did not successfully update BDP, we must return. Otherwise,
* NOLA can drift downwards */
diff --git a/src/core/or/congestion_control_vegas.c b/src/core/or/congestion_control_vegas.c
index 5c62787375..5451d7849c 100644
--- a/src/core/or/congestion_control_vegas.c
+++ b/src/core/or/congestion_control_vegas.c
@@ -22,6 +22,7 @@
#include "core/or/origin_circuit_st.h"
#include "core/or/channel.h"
#include "feature/nodelist/networkstatus.h"
+#include "feature/control/control_events.h"
#define OUTBUF_CELLS (2*TLS_RECORD_MAX_CELLS)
@@ -236,6 +237,14 @@ congestion_control_vegas_process_sendme(congestion_control_t *cc,
cc->cwnd = vegas_bdp_mix(cc) + cc->vegas_params.gamma;
cc->in_slow_start = 0;
log_info(LD_CIRC, "CC: TOR_VEGAS exiting slow start");
+
+ /* We need to report that slow start has exited ASAP,
+ * for sbws bandwidth measurement. */
+ if (CIRCUIT_IS_ORIGIN(circ)) {
+ /* We must discard const here because the event modifies fields :/ */
+ control_event_circ_bandwidth_used_for_circ(
+ TO_ORIGIN_CIRCUIT((circuit_t*)circ));
+ }
}
} else {
if (queue_use > cc->vegas_params.delta) {
diff --git a/src/core/or/congestion_control_westwood.c b/src/core/or/congestion_control_westwood.c
index 357cdeb3b9..2e4575554a 100644
--- a/src/core/or/congestion_control_westwood.c
+++ b/src/core/or/congestion_control_westwood.c
@@ -22,6 +22,7 @@
#include "core/or/origin_circuit_st.h"
#include "core/or/channel.h"
#include "feature/nodelist/networkstatus.h"
+#include "feature/control/control_events.h"
#define USEC_ONE_MS (1000)
@@ -179,6 +180,14 @@ congestion_control_westwood_process_sendme(congestion_control_t *cc,
log_info(LD_CIRC, "CC: TOR_WESTWOOD congestion. New max RTT: %"PRIu64,
cc->max_rtt_usec/1000);
+
+ /* We need to report that slow start has exited ASAP,
+ * for sbws bandwidth measurement. */
+ if (CIRCUIT_IS_ORIGIN(circ)) {
+ /* We must discard const here because the event modifies fields :/ */
+ control_event_circ_bandwidth_used_for_circ(
+ TO_ORIGIN_CIRCUIT((circuit_t*)circ));
+ }
}
/* cwnd can never fall below 1 increment */