diff options
author | Mike Perry <mikeperry-git@torproject.org> | 2022-03-08 23:07:07 +0000 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2022-03-14 15:16:26 -0400 |
commit | f6f7c4e84624a68037ff5a237090777acbdc5033 (patch) | |
tree | 2743fff5cdd56b2826c3bef891c3374602c1272c /src | |
parent | cf8d9fb1a0c03aab30097e4ad41ea2bb35054ad4 (diff) | |
download | tor-f6f7c4e84624a68037ff5a237090777acbdc5033.tar.gz tor-f6f7c4e84624a68037ff5a237090777acbdc5033.zip |
Emit control port notification for XON/XOFF
Diffstat (limited to 'src')
-rw-r--r-- | src/core/or/congestion_control_flow.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/core/or/congestion_control_flow.c b/src/core/or/congestion_control_flow.c index 3a3a9522fd..035337b55e 100644 --- a/src/core/or/congestion_control_flow.c +++ b/src/core/or/congestion_control_flow.c @@ -22,6 +22,7 @@ #include "core/or/trace_probes_cc.h" #include "feature/nodelist/networkstatus.h" #include "trunnel/flow_control_cells.h" +#include "feature/control/control_events.h" #include "core/or/connection_st.h" #include "core/or/cell_st.h" @@ -147,6 +148,13 @@ circuit_send_stream_xoff(edge_connection_t *stream) if (connection_edge_send_command(stream, RELAY_COMMAND_XOFF, (char*)payload, (size_t)xoff_size) == 0) { stream->xoff_sent = true; + + /* If this is an entry conn, notify control port */ + if (TO_CONN(stream)->type == CONN_TYPE_AP) { + control_event_stream_status(TO_ENTRY_CONN(TO_CONN(stream)), + STREAM_EVENT_XOFF_SENT, + 0); + } } } @@ -213,6 +221,13 @@ circuit_send_stream_xon(edge_connection_t *stream) (size_t)xon_size) == 0) { /* Revert the xoff sent status, so we can send another one if need be */ stream->xoff_sent = false; + + /* If it's an entry conn, notify control port */ + if (TO_CONN(stream)->type == CONN_TYPE_AP) { + control_event_stream_status(TO_ENTRY_CONN(TO_CONN(stream)), + STREAM_EVENT_XON_SENT, + 0); + } } } @@ -299,6 +314,13 @@ circuit_process_stream_xoff(edge_connection_t *conn, connection_stop_reading(TO_CONN(conn)); conn->xoff_received = true; + /* If this is an entry conn, notify control port */ + if (TO_CONN(conn)->type == CONN_TYPE_AP) { + control_event_stream_status(TO_ENTRY_CONN(TO_CONN(conn)), + STREAM_EVENT_XOFF_RECV, + 0); + } + return retval; } @@ -403,6 +425,13 @@ circuit_process_stream_xon(edge_connection_t *conn, connection_start_reading(TO_CONN(conn)); } + /* If this is an entry conn, notify control port */ + if (TO_CONN(conn)->type == CONN_TYPE_AP) { + control_event_stream_status(TO_ENTRY_CONN(TO_CONN(conn)), + STREAM_EVENT_XON_RECV, + 0); + } + xon_cell_free(xon); return retval; |