summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Perry <mikeperry-git@torproject.org>2023-06-26 18:51:48 +0000
committerMike Perry <mikeperry-git@torproject.org>2023-06-27 16:44:07 +0000
commit641ed48e6dabc9adb30d3982e8bc210351f9c2b4 (patch)
tree067cbea923cb867bd587317e2b4fbccb97b4b760
parent99ad0de9f5944bfb6698ec670d67c700ee564586 (diff)
downloadtor-641ed48e6dabc9adb30d3982e8bc210351f9c2b4.tar.gz
tor-641ed48e6dabc9adb30d3982e8bc210351f9c2b4.zip
Bug 40566: Unhook unused congestion control algs
-rw-r--r--src/core/or/congestion_control_common.c57
-rw-r--r--src/core/or/include.am4
2 files changed, 15 insertions, 46 deletions
diff --git a/src/core/or/congestion_control_common.c b/src/core/or/congestion_control_common.c
index f747987957..2039354c1f 100644
--- a/src/core/or/congestion_control_common.c
+++ b/src/core/or/congestion_control_common.c
@@ -22,8 +22,6 @@
#include "core/or/congestion_control_st.h"
#include "core/or/congestion_control_common.h"
#include "core/or/congestion_control_vegas.h"
-#include "core/or/congestion_control_nola.h"
-#include "core/or/congestion_control_westwood.h"
#include "core/or/congestion_control_st.h"
#include "core/or/conflux.h"
#include "core/or/conflux_util.h"
@@ -216,6 +214,13 @@ congestion_control_new_consensus_params(const networkstatus_t *ns)
CC_ALG_DFLT,
CC_ALG_MIN,
CC_ALG_MAX);
+ if (cc_alg != CC_ALG_SENDME && cc_alg != CC_ALG_VEGAS) {
+ // Does not need rate limiting because consensus updates
+ // are at most 1x/hour
+ log_warn(LD_BUG, "Unsupported congestion control algorithm %d",
+ cc_alg);
+ cc_alg = CC_ALG_DFLT;
+ }
#define BWE_SENDME_MIN_MIN 2
#define BWE_SENDME_MIN_MAX (20)
@@ -316,37 +321,19 @@ congestion_control_init_params(congestion_control_t *cc,
cc->cc_alg = cc_alg;
}
- bdp_alg_t default_bdp_alg = 0;
-
- switch (cc->cc_alg) {
- case CC_ALG_WESTWOOD:
- default_bdp_alg = WESTWOOD_BDP_ALG;
- break;
- case CC_ALG_VEGAS:
- default_bdp_alg = VEGAS_BDP_MIX_ALG;
- break;
- case CC_ALG_NOLA:
- default_bdp_alg = NOLA_BDP_ALG;
- break;
- case CC_ALG_SENDME:
- default:
- tor_fragile_assert();
- return; // No alg-specific params
- }
-
cc->bdp_alg =
networkstatus_get_param(NULL, "cc_bdp_alg",
- default_bdp_alg,
+ VEGAS_BDP_MIX_ALG,
0,
NUM_BDP_ALGS-1);
/* Algorithm-specific parameters */
- if (cc->cc_alg == CC_ALG_WESTWOOD) {
- congestion_control_westwood_set_params(cc);
- } else if (cc->cc_alg == CC_ALG_VEGAS) {
+ if (cc->cc_alg == CC_ALG_VEGAS) {
congestion_control_vegas_set_params(cc, path);
- } else if (cc->cc_alg == CC_ALG_NOLA) {
- congestion_control_nola_set_params(cc);
+ } else {
+ // This should not happen anymore
+ log_warn(LD_BUG, "Unknown congestion control algorithm %d",
+ cc->cc_alg);
}
}
@@ -1203,23 +1190,9 @@ congestion_control_dispatch_cc_alg(congestion_control_t *cc,
const crypt_path_t *layer_hint)
{
int ret = -END_CIRC_REASON_INTERNAL;
- switch (cc->cc_alg) {
- case CC_ALG_WESTWOOD:
- ret = congestion_control_westwood_process_sendme(cc, circ, layer_hint);
- break;
-
- case CC_ALG_VEGAS:
- ret = congestion_control_vegas_process_sendme(cc, circ, layer_hint);
- break;
- case CC_ALG_NOLA:
- ret = congestion_control_nola_process_sendme(cc, circ, layer_hint);
- break;
-
- case CC_ALG_SENDME:
- default:
- tor_assert(0);
- }
+ tor_assert_nonfatal_once(cc->cc_alg == CC_ALG_VEGAS);
+ ret = congestion_control_vegas_process_sendme(cc, circ, layer_hint);
if (cc->cwnd > cwnd_max) {
static ratelim_t cwnd_limit = RATELIM_INIT(60);
diff --git a/src/core/or/include.am b/src/core/or/include.am
index 12456b98dd..d0dffd5d3b 100644
--- a/src/core/or/include.am
+++ b/src/core/or/include.am
@@ -36,8 +36,6 @@ LIBTOR_APP_A_SOURCES += \
src/core/or/sendme.c \
src/core/or/congestion_control_common.c \
src/core/or/congestion_control_vegas.c \
- src/core/or/congestion_control_nola.c \
- src/core/or/congestion_control_westwood.c \
src/core/or/congestion_control_flow.c \
src/core/or/conflux.c \
src/core/or/conflux_cell.c \
@@ -112,8 +110,6 @@ noinst_HEADERS += \
src/core/or/congestion_control_flow.h \
src/core/or/congestion_control_common.h \
src/core/or/congestion_control_vegas.h \
- src/core/or/congestion_control_nola.h \
- src/core/or/congestion_control_westwood.h \
src/core/or/conflux.h \
src/core/or/conflux_cell.h \
src/core/or/conflux_params.h \