aboutsummaryrefslogtreecommitdiff
path: root/src/feature/control
diff options
context:
space:
mode:
authorMike Perry <mikeperry-git@torproject.org>2022-03-03 20:06:38 +0000
committerMike Perry <mikeperry-git@torproject.org>2022-03-03 20:06:38 +0000
commit646a1d5f9ae481667f0ec43e45879b94ea2dd28a (patch)
tree61a07511de27be0a89449602f2bcbff3b6e2dc0f /src/feature/control
parent331b2aa34874d5ef57b45ff591e1f64b695ff06c (diff)
downloadtor-646a1d5f9ae481667f0ec43e45879b94ea2dd28a.tar.gz
tor-646a1d5f9ae481667f0ec43e45879b94ea2dd28a.zip
Add congestion control fields to CIRC_BW control port event
Diffstat (limited to 'src/feature/control')
-rw-r--r--src/feature/control/control_events.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/feature/control/control_events.c b/src/feature/control/control_events.c
index e2aca6c03e..f9b7caf934 100644
--- a/src/feature/control/control_events.c
+++ b/src/feature/control/control_events.c
@@ -21,6 +21,7 @@
#include "core/or/command.h"
#include "core/or/connection_edge.h"
#include "core/or/connection_or.h"
+#include "core/or/congestion_control_common.h"
#include "core/or/reasons.h"
#include "feature/control/control.h"
#include "feature/control/control_events.h"
@@ -1075,10 +1076,12 @@ control_event_circ_bandwidth_used_for_circ(origin_circuit_t *ocirc)
tor_gettimeofday(&now);
format_iso_time_nospace_usec(tbuf, &now);
+
+ char *ccontrol_buf = congestion_control_get_control_port_fields(ocirc);
send_control_event(EVENT_CIRC_BANDWIDTH_USED,
"650 CIRC_BW ID=%d READ=%lu WRITTEN=%lu TIME=%s "
"DELIVERED_READ=%lu OVERHEAD_READ=%lu "
- "DELIVERED_WRITTEN=%lu OVERHEAD_WRITTEN=%lu\r\n",
+ "DELIVERED_WRITTEN=%lu OVERHEAD_WRITTEN=%lu%s\r\n",
ocirc->global_identifier,
(unsigned long)ocirc->n_read_circ_bw,
(unsigned long)ocirc->n_written_circ_bw,
@@ -1086,11 +1089,16 @@ control_event_circ_bandwidth_used_for_circ(origin_circuit_t *ocirc)
(unsigned long)ocirc->n_delivered_read_circ_bw,
(unsigned long)ocirc->n_overhead_read_circ_bw,
(unsigned long)ocirc->n_delivered_written_circ_bw,
- (unsigned long)ocirc->n_overhead_written_circ_bw);
+ (unsigned long)ocirc->n_overhead_written_circ_bw,
+ ccontrol_buf ? ccontrol_buf : "");
+
ocirc->n_written_circ_bw = ocirc->n_read_circ_bw = 0;
ocirc->n_overhead_written_circ_bw = ocirc->n_overhead_read_circ_bw = 0;
ocirc->n_delivered_written_circ_bw = ocirc->n_delivered_read_circ_bw = 0;
+ if (ccontrol_buf)
+ tor_free(ccontrol_buf);
+
return 0;
}