aboutsummaryrefslogtreecommitdiff
path: root/src/feature
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2022-03-14 15:17:05 -0400
committerDavid Goulet <dgoulet@torproject.org>2022-03-14 15:17:05 -0400
commit1934e24469bf7184b825efe2b9b0436b1bc35695 (patch)
tree8efc41f3047c60649f5fbe86bf9b393f5303124e /src/feature
parentdf6625300dffe6558ab40e6dbc3a938ffb6daba1 (diff)
parent9f0b0afa2e62a5bc55a814bfe991859e08bcb1aa (diff)
downloadtor-1934e24469bf7184b825efe2b9b0436b1bc35695.tar.gz
tor-1934e24469bf7184b825efe2b9b0436b1bc35695.zip
Merge branch 'tor-gitlab/mr/546'
Diffstat (limited to 'src/feature')
-rw-r--r--src/feature/control/control_events.c16
-rw-r--r--src/feature/control/control_events.h6
2 files changed, 19 insertions, 3 deletions
diff --git a/src/feature/control/control_events.c b/src/feature/control/control_events.c
index e2aca6c03e..4c8cf9a425 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"
@@ -819,6 +820,10 @@ control_event_stream_status(entry_connection_t *conn, stream_status_event_t tp,
case STREAM_EVENT_FAILED_RETRIABLE: status = "DETACHED"; break;
case STREAM_EVENT_REMAP: status = "REMAP"; break;
case STREAM_EVENT_CONTROLLER_WAIT: status = "CONTROLLER_WAIT"; break;
+ case STREAM_EVENT_XOFF_SENT: status = "XOFF_SENT"; break;
+ case STREAM_EVENT_XOFF_RECV: status = "XOFF_RECV"; break;
+ case STREAM_EVENT_XON_SENT: status = "XON_SENT"; break;
+ case STREAM_EVENT_XON_RECV: status = "XON_RECV"; break;
default:
log_warn(LD_BUG, "Unrecognized status code %d", (int)tp);
return 0;
@@ -1075,10 +1080,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 +1093,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;
}
diff --git a/src/feature/control/control_events.h b/src/feature/control/control_events.h
index 68269cabba..901d2701cf 100644
--- a/src/feature/control/control_events.h
+++ b/src/feature/control/control_events.h
@@ -37,7 +37,11 @@ typedef enum stream_status_event_t {
STREAM_EVENT_NEW_RESOLVE = 6,
STREAM_EVENT_FAILED_RETRIABLE = 7,
STREAM_EVENT_REMAP = 8,
- STREAM_EVENT_CONTROLLER_WAIT = 9
+ STREAM_EVENT_CONTROLLER_WAIT = 9,
+ STREAM_EVENT_XOFF_SENT = 10,
+ STREAM_EVENT_XOFF_RECV = 11,
+ STREAM_EVENT_XON_SENT = 12,
+ STREAM_EVENT_XON_RECV = 13
} stream_status_event_t;
/** Used to indicate the type of a buildtime event */