]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
cc: Change edge_get_ccontrol() to look at both cpath and on_circuit
authorDavid Goulet <dgoulet@torproject.org>
Wed, 12 Jan 2022 16:49:04 +0000 (11:49 -0500)
committerMike Perry <mikeperry-git@torproject.org>
Tue, 22 Feb 2022 19:28:35 +0000 (19:28 +0000)
Signed-off-by: David Goulet <dgoulet@torproject.org>
src/core/or/congestion_control_flow.c

index d61da736277a30cb524e80bf8996b3ae0b990595..c8b5ba247359676c128fb75989fb351ff05d839d 100644 (file)
@@ -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;
 }
 
 /**