Tor 0.4.9.0-alpha-dev
Functions | Variables
congestion_control_flow.h File Reference

APIs for stream flow control on congestion controlled circuits. More...

#include "core/or/crypt_path_st.h"
#include "core/or/circuit_st.h"
#include "core/or/edge_connection_st.h"

Go to the source code of this file.

Functions

void flow_control_new_consensus_params (const struct networkstatus_t *)
 
bool circuit_process_stream_xoff (edge_connection_t *conn, const crypt_path_t *layer_hint, const cell_t *cell)
 
bool circuit_process_stream_xon (edge_connection_t *conn, const crypt_path_t *layer_hint, const cell_t *cell)
 
int flow_control_decide_xoff (edge_connection_t *stream)
 
void flow_control_decide_xon (edge_connection_t *stream, size_t n_written)
 
void flow_control_note_sent_data (edge_connection_t *stream, size_t len)
 
bool edge_uses_flow_control (const edge_connection_t *stream)
 
bool conn_uses_flow_control (connection_t *stream)
 

Variables

uint64_t cc_stats_flow_num_xoff_sent
 
uint64_t cc_stats_flow_num_xon_sent
 
double cc_stats_flow_xoff_outbuf_ma
 
double cc_stats_flow_xon_outbuf_ma
 

Detailed Description

APIs for stream flow control on congestion controlled circuits.

Definition in file congestion_control_flow.h.

Function Documentation

◆ circuit_process_stream_xoff()

bool circuit_process_stream_xoff ( edge_connection_t conn,
const crypt_path_t layer_hint,
const cell_t cell 
)

Process a stream XOFF, parsing it, and then stopping reading on the edge connection.

Record that we have received an xoff, so we know not to resume reading on this edge conn until we get an XON.

Returns false if the XOFF did not validate; true if it does.

Definition at line 234 of file congestion_control_flow.c.

◆ circuit_process_stream_xon()

bool circuit_process_stream_xon ( edge_connection_t conn,
const crypt_path_t layer_hint,
const cell_t cell 
)

Process a stream XON, and if it validates, clear the xoff flag and resume reading on this edge connection.

Also, use provided rate information to rate limit reading on this edge (or packagaing from it onto the circuit), to avoid XON/XOFF chatter.

Returns true if the XON validates, false otherwise.

Definition at line 328 of file congestion_control_flow.c.

◆ conn_uses_flow_control()

bool conn_uses_flow_control ( connection_t conn)

Returns true if a connection is an edge conn that uses flow control

Definition at line 702 of file congestion_control_flow.c.

◆ edge_uses_flow_control()

bool edge_uses_flow_control ( const edge_connection_t stream)

Returns true if an edge connection uses flow control

Definition at line 691 of file congestion_control_flow.c.

Referenced by conn_uses_flow_control().

◆ flow_control_decide_xoff()

int flow_control_decide_xoff ( edge_connection_t stream)

Called from sendme_stream_data_received(), when data arrives from a circuit to our edge's outbuf, to decide if we need to send an XOFF.

Returns the amount of cells remaining until the buffer is full, at which point it sends an XOFF, and returns 0.

Returns less than 0 if we have queued more than a congestion window worth of data and need to close the circuit.

Definition at line 442 of file congestion_control_flow.c.

◆ flow_control_decide_xon()

void flow_control_decide_xon ( edge_connection_t stream,
size_t  n_written 
)

Called whenever we drain an edge connection outbuf by writing on its socket, to decide if it is time to send an xon.

The n_written parameter tells us how many bytes we have written this time, which is used to compute the advisory drain rate fields.

Definition at line 530 of file congestion_control_flow.c.

◆ flow_control_note_sent_data()

void flow_control_note_sent_data ( edge_connection_t stream,
size_t  len 
)

Note that we packaged some data on this stream. Used to enforce client-side dropmark limits

Definition at line 672 of file congestion_control_flow.c.

Variable Documentation

◆ cc_stats_flow_num_xoff_sent

uint64_t cc_stats_flow_num_xoff_sent
extern

Metricsport externs

Metricsport stats

Definition at line 42 of file congestion_control_flow.c.

Referenced by fill_cc_counters_values().

◆ cc_stats_flow_num_xon_sent

uint64_t cc_stats_flow_num_xon_sent
extern

Definition at line 43 of file congestion_control_flow.c.

◆ cc_stats_flow_xoff_outbuf_ma

double cc_stats_flow_xoff_outbuf_ma
extern

Definition at line 44 of file congestion_control_flow.c.

◆ cc_stats_flow_xon_outbuf_ma

double cc_stats_flow_xon_outbuf_ma
extern

Definition at line 45 of file congestion_control_flow.c.