summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2022-01-12 11:49:04 -0500
committerMike Perry <mikeperry-git@torproject.org>2022-02-22 19:28:35 +0000
commitd4cf3fadec94169e4610717beaf4597456cbd961 (patch)
tree617bd0a3145536aea12617167caf67e0b3a60032
parent27d948dab8f579890abdef155d20062938b84259 (diff)
downloadtor-d4cf3fadec94169e4610717beaf4597456cbd961.tar.gz
tor-d4cf3fadec94169e4610717beaf4597456cbd961.zip
cc: Change edge_get_ccontrol() to look at both cpath and on_circuit
Signed-off-by: David Goulet <dgoulet@torproject.org>
-rw-r--r--src/core/or/congestion_control_flow.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/core/or/congestion_control_flow.c b/src/core/or/congestion_control_flow.c
index d61da73627..c8b5ba2473 100644
--- a/src/core/or/congestion_control_flow.c
+++ b/src/core/or/congestion_control_flow.c
@@ -62,12 +62,15 @@ static uint32_t xon_rate_bytes;
static inline const congestion_control_t *
edge_get_ccontrol(const edge_connection_t *edge)
{
- if (edge->cpath_layer)
- return edge->cpath_layer->ccontrol;
- else if (edge->on_circuit)
- return edge->on_circuit->ccontrol;
- else
- return NULL;
+ congestion_control_t *ccontrol = NULL;
+
+ if (edge->on_circuit && edge->on_circuit->ccontrol) {
+ ccontrol = edge->on_circuit->ccontrol;
+ } else if (edge->cpath_layer && edge->cpath_layer->ccontrol) {
+ ccontrol = edge->cpath_layer->ccontrol;
+ }
+
+ return ccontrol;
}
/**