aboutsummaryrefslogtreecommitdiff
path: root/src/core/or/circuitbuild.c
diff options
context:
space:
mode:
authorMike Perry <mikeperry-git@torproject.org>2022-02-03 12:01:23 +0000
committerMike Perry <mikeperry-git@torproject.org>2022-02-22 19:28:35 +0000
commitb2553bfba28b2e26f09041a3d78fa39c35fd4ac8 (patch)
tree896677eaf525afbe5decee7c628b5d73b6e5a7b8 /src/core/or/circuitbuild.c
parent0a6cde8756423336c8e6901b55c31d67a2a35245 (diff)
downloadtor-b2553bfba28b2e26f09041a3d78fa39c35fd4ac8.tar.gz
tor-b2553bfba28b2e26f09041a3d78fa39c35fd4ac8.zip
Use path type hint for Vegas queue parameters.
These parameters will vary depending on path length, especially for onions.
Diffstat (limited to 'src/core/or/circuitbuild.c')
-rw-r--r--src/core/or/circuitbuild.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/core/or/circuitbuild.c b/src/core/or/circuitbuild.c
index 2326dc2a6d..f62a1d93f5 100644
--- a/src/core/or/circuitbuild.c
+++ b/src/core/or/circuitbuild.c
@@ -1275,7 +1275,21 @@ circuit_finish_handshake(origin_circuit_t *circ,
}
if (params.cc_enabled) {
- hop->ccontrol = congestion_control_new(&params);
+ int circ_len = circuit_get_cpath_len(circ);
+
+ if (circ_len == DEFAULT_ROUTE_LEN &&
+ circuit_get_cpath_hop(circ, DEFAULT_ROUTE_LEN) == hop) {
+ hop->ccontrol = congestion_control_new(&params, CC_PATH_EXIT);
+ } else if (circ_len == SBWS_ROUTE_LEN &&
+ circuit_get_cpath_hop(circ, SBWS_ROUTE_LEN) == hop) {
+ hop->ccontrol = congestion_control_new(&params, CC_PATH_SBWS);
+ } else {
+ static ratelim_t cc_path_limit = RATELIM_INIT(600);
+ log_fn_ratelim(&cc_path_limit, LOG_WARN, LD_CIRC,
+ "Unexpected path length %d for circuit",
+ circ_len);
+ hop->ccontrol = congestion_control_new(&params, CC_PATH_EXIT);
+ }
}
hop->state = CPATH_STATE_OPEN;