|
Tor 0.4.9.3-alpha-dev
|
Handle relay cell encryption/decryption, plus packaging and receiving from circuits, plus queuing on circuits. More...
#include "lib/log/log.h"#include "core/or/or.h"#include "feature/client/addressmap.h"#include "lib/err/backtrace.h"#include "lib/buf/buffers.h"#include "core/or/channel.h"#include "feature/client/circpathbias.h"#include "core/or/circuitbuild.h"#include "core/or/circuitlist.h"#include "core/or/circuituse.h"#include "core/or/circuitpadding.h"#include "core/or/extendinfo.h"#include "lib/compress/compress.h"#include "app/config/config.h"#include "core/mainloop/connection.h"#include "core/or/connection_edge.h"#include "core/or/connection_or.h"#include "feature/control/control_events.h"#include "lib/crypt_ops/crypto_rand.h"#include "lib/crypt_ops/crypto_util.h"#include "feature/dircommon/directory.h"#include "feature/relay/dns.h"#include "feature/relay/circuitbuild_relay.h"#include "feature/stats/geoip_stats.h"#include "feature/hs/hs_cache.h"#include "core/mainloop/mainloop.h"#include "feature/nodelist/networkstatus.h"#include "feature/nodelist/nodelist.h"#include "core/or/onion.h"#include "core/or/policies.h"#include "core/or/reasons.h"#include "core/or/relay.h"#include "core/crypto/relay_crypto.h"#include "feature/rend/rendcommon.h"#include "feature/nodelist/describe.h"#include "feature/nodelist/routerlist.h"#include "core/or/scheduler.h"#include "feature/hs/hs_metrics.h"#include "feature/stats/rephist.h"#include "core/or/relay_msg.h"#include "core/or/cell_st.h"#include "core/or/cell_queue_st.h"#include "core/or/cpath_build_state_st.h"#include "feature/dircommon/dir_connection_st.h"#include "core/or/destroy_cell_queue_st.h"#include "core/or/entry_connection_st.h"#include "core/or/extend_info_st.h"#include "core/or/or_circuit_st.h"#include "core/or/origin_circuit_st.h"#include "feature/nodelist/routerinfo_st.h"#include "core/or/socks_request_st.h"#include "core/or/sendme.h"#include "core/or/congestion_control_common.h"#include "core/or/congestion_control_flow.h"#include "core/or/conflux.h"#include "core/or/conflux_util.h"#include "core/or/conflux_pool.h"#include "core/or/relay_msg_st.h"Go to the source code of this file.
Macros | |
| #define | RELAY_PRIVATE |
| #define | MAX_RESOLVE_FAILURES 3 |
| #define | EARLY_WARNING_INTERVAL 3600 |
| #define | RELAY_CELL_PADDING_GAP 4 |
| #define | MEMORY_PRESSURE_INTERVAL (30*60) |
| #define | RELAY_CIRC_CELL_QUEUE_SIZE_MIN 50 |
| #define | RELAY_CIRC_CELL_QUEUE_SIZE_MAX INT32_MAX |
| #define | RELAY_CIRC_CELL_QUEUE_SIZE_DEFAULT (50 * RELAY_CIRC_CELL_QUEUE_SIZE_MIN) |
Variables | |
| uint64_t | stats_n_relay_cells_relayed = 0 |
| uint64_t | stats_n_relay_cells_delivered = 0 |
| uint64_t | stats_n_circ_max_cell_reached = 0 |
| uint64_t | stats_n_circ_max_cell_outq_reached = 0 |
| uint64_t | stats_n_data_cells_packaged = 0 |
| uint64_t | stats_n_data_bytes_packaged = 0 |
| uint64_t | stats_n_data_cells_received = 0 |
| uint64_t | stats_n_data_bytes_received = 0 |
| static size_t | total_cells_allocated = 0 |
| static time_t | last_time_under_memory_pressure = 0 |
| uint64_t | oom_stats_n_bytes_removed_dns = 0 |
| uint64_t | oom_stats_n_bytes_removed_cell = 0 |
| uint64_t | oom_stats_n_bytes_removed_geoip = 0 |
| uint64_t | oom_stats_n_bytes_removed_hsdir = 0 |
| static int32_t | max_circuit_cell_queue_size |
| static int32_t | max_circuit_cell_queue_size_out |
Handle relay cell encryption/decryption, plus packaging and receiving from circuits, plus queuing on circuits.
This is a core modules that makes Tor work. It's responsible for dealing with RELAY cells (the ones that travel more than one hop along a circuit), by:
RELAY cells are generated throughout the code at the client or relay side, using relay_send_command_from_edge() or one of the functions like connection_edge_send_command() that calls it. Of particular interest is connection_edge_package_raw_inbuf(), which takes information that has arrived on an edge connection socket, and packages it as a RELAY_DATA cell – this is how information is actually sent across the Tor network. The cryptography for these functions is handled deep in circuit_package_relay_cell(), which either adds a single layer of encryption (if we're an exit), or multiple layers (if we're the origin of the circuit). After construction and encryption, the RELAY cells are passed to append_cell_to_circuit_queue(), which queues them for transmission and tells the circuitmux (see circuitmux.c) that the circuit is waiting to send something.
Incoming RELAY cells arrive at circuit_receive_relay_cell(), called from command.c. There they are decrypted and, if they are for us, are passed to connection_edge_process_relay_cell(). If they're not for us, they're re-queued for retransmission again with append_cell_to_circuit_queue().
The connection_edge_process_relay_cell() function handles all the different types of relay cells, launching requests or transmitting data as needed.
Definition in file relay.c.
| #define MAX_RESOLVE_FAILURES 3 |
| #define MEMORY_PRESSURE_INTERVAL (30*60) |
| #define RELAY_CIRC_CELL_QUEUE_SIZE_DEFAULT (50 * RELAY_CIRC_CELL_QUEUE_SIZE_MIN) |
| STATIC void address_ttl_free_ | ( | address_ttl_t * | addr | ) |
|
static |
Called when we have gotten an END_REASON_EXITPOLICY failure on circ for conn, while attempting to connect via node. If the node told us which address it rejected, then addr is that address; otherwise it is AF_UNSPEC.
If we are sure the node should have allowed this address, mark the node as having a reject *:* exit policy. Otherwise, mark the circuit as unusable for this particular address.
Definition at line 1045 of file relay.c.
Referenced by connection_ap_process_end_not_open().
| int append_address_to_payload | ( | uint8_t * | payload_out, |
| const tor_addr_t * | addr | ||
| ) |
Append an encoded value of addr to payload_out, which must have at least 18 bytes of free space. The encoding is, as specified in tor-spec.txt: RESOLVED_TYPE_IPV4 or RESOLVED_TYPE_IPV6 [1 byte] LENGTH [1 byte] ADDRESS [length bytes] Return the number of bytes added, or -1 on error
| int append_cell_to_circuit_queue | ( | circuit_t * | circ, |
| channel_t * | chan, | ||
| cell_t * | cell, | ||
| cell_direction_t | direction, | ||
| streamid_t | fromstream | ||
| ) |
Add cell to the queue of circ writing to chan transmitting in direction.
The given cell is copied onto the circuit queue so the caller must cleanup the memory.
This function is part of the fast path.
Return 1 if the cell was successfully sent. Return 0 if the cell can not be sent. The caller MUST NOT close the circuit. Return -1 indicating an error and that the caller should mark the circuit for close.
Definition at line 3354 of file relay.c.
Referenced by circuit_deliver_create_cell(), circuit_package_relay_cell(), circuit_receive_relay_cell(), and onionskin_answer().
| void cell_queue_append | ( | cell_queue_t * | queue, |
| packed_cell_t * | cell | ||
| ) |
Append cell to the end of queue.
Definition at line 2704 of file relay.c.
Referenced by cell_queue_append_packed_copy().
| void cell_queue_append_packed_copy | ( | circuit_t * | circ, |
| cell_queue_t * | queue, | ||
| int | exitward, | ||
| const cell_t * | cell, | ||
| int | wide_circ_ids, | ||
| int | use_stats | ||
| ) |
Append a newly allocated copy of cell to the end of the exitward (or app-ward) queue of circ. If use_stats is true, record statistics about the cell.
Definition at line 2715 of file relay.c.
Referenced by append_cell_to_circuit_queue().
| void cell_queue_clear | ( | cell_queue_t * | queue | ) |
Remove and free every cell in queue.
Definition at line 2739 of file relay.c.
Referenced by circuit_clear_cell_queue(), circuit_free_(), and marked_circuit_free_cells().
| void cell_queue_init | ( | cell_queue_t * | queue | ) |
Initialize queue as an empty cell queue.
Definition at line 2731 of file relay.c.
Referenced by init_circuit_base(), and or_circuit_new().
| STATIC packed_cell_t * cell_queue_pop | ( | cell_queue_t * | queue | ) |
Extract and return the cell at the head of queue; return NULL if queue is empty.
Definition at line 2753 of file relay.c.
Referenced by channel_flush_from_first_active_circuit().
| STATIC int cell_queues_check_size | ( | void | ) |
Check whether we've got too much space used for cells. If so, call the OOM handler and return 1. Otherwise, return 0.
Definition at line 2859 of file relay.c.
Referenced by append_cell_to_circuit_queue().
| int channel_flush_from_first_active_circuit | ( | channel_t * | chan, |
| int | max | ||
| ) |
Pull as many cells as possible (but no more than max) from the queue of the first active circuit on chan, and write them to chan->outbuf. Return the number of cells written. Advance the active circuit pointer to the next active circuit in the ring.
Definition at line 3094 of file relay.c.
Referenced by channel_flush_some_cells().
| void channel_unlink_all_circuits | ( | channel_t * | chan, |
| smartlist_t * | circuits_out | ||
| ) |
Remove all circuits from the cmux on chan.
If circuits_out is non-NULL, add all detached circuits to circuits_out.
Definition at line 2986 of file relay.c.
Referenced by circuit_unlink_all_from_channel().
Remove all the cells queued on circ for chan.
Definition at line 3499 of file relay.c.
Referenced by circuit_about_to_free(), circuit_about_to_free_atexit(), and handle_relay_msg().
|
static |
Check if the package window for circ is empty (at hop layer_hint if it's defined).
If yes, tell edge streams to stop reading and return 1. Else return 0.
Definition at line 2614 of file relay.c.
Referenced by circuit_resume_edge_reading_helper(), and connection_edge_package_raw_inbuf().
| relay_cell_fmt_t circuit_get_relay_format | ( | const circuit_t * | circ, |
| const crypt_path_t * | cpath | ||
| ) |
Return the format to use.
NULL can be passed but not for both.
Definition at line 3539 of file relay.c.
Referenced by circuit_max_relay_payload(), circuit_receive_relay_cell(), connection_edge_get_inbuf_bytes_to_package(), and relay_send_command_from_edge_().
| size_t circuit_max_relay_payload | ( | const circuit_t * | circ, |
| const crypt_path_t * | cpath, | ||
| uint8_t | relay_command | ||
| ) |
Return the maximum relay payload that can be sent to the chosen point, with the specified command.
Definition at line 3557 of file relay.c.
Referenced by circuit_send_intermediate_onion_skin(), command_process_created_cell(), and connection_ap_handshake_send_begin().
| int circuit_package_relay_cell | ( | cell_t * | cell, |
| circuit_t * | circ, | ||
| cell_direction_t | cell_direction, | ||
| crypt_path_t * | layer_hint, | ||
| streamid_t | on_stream, | ||
| const char * | filename, | ||
| int | lineno | ||
| ) |
Package a relay cell from an edge:
Return 1 if the cell was successfully sent as in queued on the circuit. Return 0 if the cell needs to be dropped as in ignored. Return -1 on error for which the circuit should be marked for close.
Definition at line 390 of file relay.c.
Referenced by relay_send_command_from_edge_().
|
static |
Return 1 if we shouldn't restart reading on this circuit, even if we get a SENDME. Else return 0.
Definition at line 3526 of file relay.c.
Referenced by circuit_resume_edge_reading(), and process_sendme_cell().
| int circuit_receive_relay_cell | ( | cell_t * | cell, |
| circuit_t * | circ, | ||
| cell_direction_t | cell_direction | ||
| ) |
Receive a relay cell:
Return -reason on failure, else 0.
Definition at line 236 of file relay.c.
Referenced by circuit_receive_relay_cell(), and command_process_relay_cell().
| void circuit_reset_sendme_randomness | ( | circuit_t * | circ | ) |
Called when initializing a circuit, or when we have reached the end of the window in which we need to send some randomness so that incoming sendme cells will be unpredictable. Resets the flags and picks a new window.
Definition at line 2195 of file relay.c.
Referenced by connection_edge_get_inbuf_bytes_to_package(), and init_circuit_base().
|
static |
The circuit circ has received a circuit-level sendme (on hop layer_hint, if we're the OP). Go through all the attached streams and let them resume reading and packaging, if their stream windows allow it.
Definition at line 2409 of file relay.c.
Referenced by process_sendme_cell().
|
static |
A helper function for circuit_resume_edge_reading() above. The arguments are the same, except that conn is the head of a linked list of edge streams that should each be considered.
Definition at line 2439 of file relay.c.
Referenced by circuit_resume_edge_reading().
Update channel usage state based on the type of relay cell and circuit properties.
This is needed to determine if a client channel is being used for application traffic, and if a relay channel is being used for multihop circuits and application traffic. The decision to pad in channelpadding.c depends upon this info (as well as consensus parameters) to decide what channels to pad.
Definition at line 158 of file relay.c.
Referenced by circuit_receive_relay_cell().
| STATIC int connected_cell_parse | ( | const relay_msg_t * | msg, |
| tor_addr_t * | addr_out, | ||
| int * | ttl_out | ||
| ) |
Extract the contents of a connected cell in cell, whose relay header has already been parsed into rh. On success, set addr_out to the address we're connected to, and ttl_out to the ttl of that address, in seconds, and return 0. On failure, return -1.
Note that the resulting address can be UNSPEC if the connected cell had no address (as for a stream to an union service or a tunneled directory connection), and that the ttl can be absent (in which case ttl_out is set to -1).
Definition at line 1100 of file relay.c.
Referenced by connection_edge_process_relay_cell_not_open().
|
static |
Helper for connection_edge_process_resolved_cell: given an error code, an entry_connection, and a list of address_ttl_t *, report the best answer to the entry_connection.
Definition at line 1248 of file relay.c.
Referenced by connection_edge_process_resolved_cell().
|
static |
Called when we receive an END cell on a stream that isn't open yet, from the client side. Arguments are as for connection_edge_process_relay_cell().
Definition at line 841 of file relay.c.
Referenced by connection_edge_process_relay_cell_not_open().
| STATIC size_t connection_edge_get_inbuf_bytes_to_package | ( | size_t | n_available, |
| int | package_partial, | ||
| circuit_t * | on_circuit, | ||
| crypt_path_t * | cpath | ||
| ) |
Helper. Return the number of bytes that should be put into a cell from a given edge connection on which n_available bytes are available.
Definition at line 2208 of file relay.c.
Referenced by connection_edge_package_raw_inbuf().
| int connection_edge_package_raw_inbuf | ( | edge_connection_t * | conn, |
| int | package_partial, | ||
| int * | max_cells | ||
| ) |
If conn has an entire relay payload of bytes on its inbuf (or package_partial is true), and the appropriate package windows aren't empty, grab a cell and send it down the circuit.
If *max_cells is given, package no more than max_cells. Decrement *max_cells by the number of cells packaged.
Return -1 (and send a RELAY_COMMAND_END cell if necessary) if conn should be marked for close, else return 0.
Definition at line 2279 of file relay.c.
Referenced by circuit_resume_edge_reading_helper(), connection_ap_handshake_send_begin(), connection_edge_process_inbuf(), connection_edge_process_relay_cell_not_open(), and process_sendme_cell().
|
static |
Helper function to process a relay cell that is in the proper order for processing right now.
Definition at line 2141 of file relay.c.
Referenced by connection_edge_process_relay_cell().
| STATIC int connection_edge_process_relay_cell | ( | const relay_msg_t * | msg, |
| circuit_t * | circ, | ||
| edge_connection_t * | conn, | ||
| crypt_path_t * | layer_hint | ||
| ) |
An incoming relay cell has arrived on circuit circ. If conn is NULL this is a control cell, else cell is destined for conn.
If layer_hint is defined, then we're the origin of the circuit, and it specifies the hop that packaged cell.
Return -reason if you want to warn and tear down the circuit, else 0.
Definition at line 2040 of file relay.c.
Referenced by circuit_receive_relay_cell().
|
static |
An incoming relay cell has arrived from circuit circ to stream conn.
The arguments here are the same as in connection_edge_process_relay_cell() below; this function is called from there when conn is defined and not in an open state.
Definition at line 1396 of file relay.c.
Referenced by connection_edge_process_ordered_relay_cell().
| STATIC int connection_edge_process_resolved_cell | ( | edge_connection_t * | conn, |
| const relay_msg_t * | msg | ||
| ) |
Handle a RELAY_COMMAND_RESOLVED cell that we received on a non-open AP stream.
Definition at line 1322 of file relay.c.
Referenced by connection_edge_process_relay_cell_not_open().
| int connection_edge_send_command | ( | edge_connection_t * | fromconn, |
| uint8_t | relay_command, | ||
| const char * | payload, | ||
| size_t | payload_len | ||
| ) |
Make a relay cell out of relay_command and payload, and send it onto the open circuit circ. fromconn is the stream that's sending the relay cell, or NULL if it's a control cell. cpath_layer is NULL for OR->OP cells, or the destination hop for OP->OR cells.
If you can't send the cell, mark the circuit for close and return -1. Else return 0.
Definition at line 764 of file relay.c.
Referenced by circuit_send_stream_xoff(), circuit_send_stream_xon(), connection_ap_handshake_send_begin(), connection_ap_handshake_send_resolve(), connection_edge_end(), connection_edge_finished_connecting(), connection_edge_package_raw_inbuf(), connection_exit_connect(), connection_exit_connect_dir(), send_resolved_cell(), send_resolved_hostname_cell(), and sendme_connection_edge_consider_sending().
| const uint8_t * decode_address_from_payload | ( | tor_addr_t * | addr_out, |
| const uint8_t * | payload, | ||
| int | payload_len | ||
| ) |
Given payload_len bytes at payload, starting with an address encoded as by append_address_to_payload(), try to decode the address into *addr_out. Return the next byte in the payload after the address on success, or NULL on failure.
| void destroy_cell_queue_append | ( | destroy_cell_queue_t * | queue, |
| circid_t | circid, | ||
| uint8_t | reason | ||
| ) |
| void destroy_cell_queue_clear | ( | destroy_cell_queue_t * | queue | ) |
Remove and free every cell in queue.
Definition at line 2773 of file relay.c.
Referenced by circuitmux_free_().
| void destroy_cell_queue_init | ( | destroy_cell_queue_t * | queue | ) |
Initialize queue as an empty cell queue.
Definition at line 2765 of file relay.c.
Referenced by circuitmux_alloc().
| STATIC destroy_cell_t * destroy_cell_queue_pop | ( | destroy_cell_queue_t * | queue | ) |
Extract and return the cell at the head of queue; return NULL if queue is empty.
Definition at line 2787 of file relay.c.
Referenced by channel_flush_from_first_active_circuit().
|
static |
Convert a destroy_cell_t to a newly allocated cell_t. Frees its input.
Definition at line 2815 of file relay.c.
Referenced by channel_flush_from_first_active_circuit().
| void dump_cell_pool_usage | ( | int | severity | ) |
Log current statistics for cell pool allocation at log level severity.
Definition at line 2677 of file relay.c.
Referenced by dumpmemusage().
|
static |
Return 1 if reason is something that you should retry if you get the end cell before you've connected; else return 0.
Definition at line 826 of file relay.c.
Referenced by connection_ap_process_end_not_open().
|
static |
Return consensus parameter "circ_max_cell_queue_size". The given ns can be NULL.
Definition at line 3307 of file relay.c.
Referenced by get_param_max_circuit_cell_queue_size_out().
|
static |
| STATIC int handle_relay_msg | ( | const relay_msg_t * | msg, |
| circuit_t * | circ, | ||
| edge_connection_t * | conn, | ||
| crypt_path_t * | layer_hint, | ||
| int | optimistic_data | ||
| ) |
A helper for connection_edge_process_relay_cell(): Actually handles the cell that we received on the connection.
The arguments are the same as in the parent function connection_edge_process_relay_cell(), plus the relay header rh as unpacked by the parent function, and optimistic_data as set by the parent function.
Definition at line 1620 of file relay.c.
Referenced by connection_edge_process_ordered_relay_cell().
| bool have_been_under_memory_pressure | ( | void | ) |
Return true if we've been under memory pressure in the last MEMORY_PRESSURE_INTERVAL seconds.
Definition at line 2930 of file relay.c.
Referenced by connection_edge_about_to_close(), and unlinked_circuit_closed().
|
inlinestatic |
Allocate a new copy of packed cell.
Definition at line 2695 of file relay.c.
Referenced by cell_queue_append_packed_copy().
| void packed_cell_free_ | ( | packed_cell_t * | cell | ) |
|
inlinestatic |
Release storage held by cell.
Definition at line 2651 of file relay.c.
Referenced by cell_queue_clear(), and packed_cell_free_().
| circid_t packed_cell_get_circid | ( | const packed_cell_t * | cell, |
| int | wide_circ_ids | ||
| ) |
| uint8_t packed_cell_get_command | ( | const packed_cell_t * | cell, |
| int | wide_circ_ids | ||
| ) |
Extract the command from a packed cell.
Definition at line 3069 of file relay.c.
Referenced by channel_flush_from_first_active_circuit(), and write_packed_cell().
| size_t packed_cell_mem_cost | ( | void | ) |
Return the total number of bytes used for each packed_cell in a queue. Approximate.
Definition at line 2832 of file relay.c.
Referenced by circuits_handle_oom().
| STATIC packed_cell_t * packed_cell_new | ( | void | ) |
Allocate and return a new packed_cell_t.
Definition at line 2659 of file relay.c.
Referenced by destroy_cell_to_packed_cell(), and packed_cell_copy().
|
static |
Process a SENDME cell that arrived on circ. If it is a stream level cell, it is destined for the given conn. If it is a circuit level cell, it is destined for the layer_hint. The domain is the logging domain that should be used.
Return 0 if everything went well or a negative value representing a circuit end reason on error for which the caller is responsible for closing it.
Definition at line 1544 of file relay.c.
Referenced by handle_relay_msg().
| const char * relay_command_to_string | ( | uint8_t | command | ) |
Convert the relay command into a human-readable string.
Definition at line 526 of file relay.c.
Referenced by fill_single_stream_value(), and relay_send_command_from_edge_().
| void relay_consensus_has_changed | ( | const networkstatus_t * | ns | ) |
|
static |
If cell's stream_id matches the stream_id of any conn that's attached to circ, return that conn, else return NULL.
Definition at line 451 of file relay.c.
Referenced by circuit_receive_relay_cell(), and connection_edge_process_relay_cell().
| int relay_send_command_from_edge_ | ( | streamid_t | stream_id, |
| circuit_t * | orig_circ, | ||
| uint8_t | relay_command, | ||
| const char * | payload, | ||
| size_t | payload_len, | ||
| crypt_path_t * | cpath_layer, | ||
| const char * | filename, | ||
| int | lineno | ||
| ) |
Make a relay cell out of relay_command and payload, and send it onto the open circuit circ. stream_id is the ID on circ for the stream that's sending the relay cell, or 0 if it's a control cell. cpath_layer is NULL for OR->OP cells, or the destination hop for OP->OR cells.
If you can't send the cell, mark the circuit for close and return -1. Else return 0.
|
static |
Helper: change the socks_request->address field on conn to the dotted-quad representation of new_addr, and send an appropriate REMAP event.
Definition at line 1080 of file relay.c.
Referenced by connection_ap_handshake_socks_got_resolved_cell(), and connection_edge_process_relay_cell_not_open().
| STATIC int resolved_cell_parse | ( | const relay_msg_t * | msg, |
| smartlist_t * | addresses_out, | ||
| int * | errcode_out | ||
| ) |
Parse a resolved cell in cell, with parsed header in rh. Return -1 on parse error. On success, add one or more newly allocated address_ttl_t to addresses_out; set *errcode_out to one of 0, RESOLVED_TYPE_ERROR, or RESOLVED_TYPE_ERROR_TRANSIENT, and return 0.
Definition at line 1152 of file relay.c.
Referenced by connection_edge_process_resolved_cell().
|
static |
Helper function to block or unblock streams in a stream list.
If stream_id is 0, apply the block state to all streams in the stream list. If it is non-zero, only apply to that specific stream.
Definition at line 3028 of file relay.c.
Referenced by append_cell_to_circuit_queue(), and set_circuit_blocked_on_chan().
Called when a circuit becomes blocked or unblocked due to the channel cell queue.
Block (if block is true) or unblock (if block is false) every edge connection that is using circ to write to chan, and start or stop reading as appropriate.
Definition at line 3005 of file relay.c.
Referenced by append_cell_to_circuit_queue(), and channel_flush_from_first_active_circuit().
| void update_circuit_on_cmux_ | ( | circuit_t * | circ, |
| cell_direction_t | direction, | ||
| const char * | file, | ||
| int | lineno | ||
| ) |
|
static |
The time at which we were last low on memory.
Definition at line 2848 of file relay.c.
Referenced by cell_queues_check_size(), and have_been_under_memory_pressure().
|
static |
|
static |
Maximum number of cell on an outbound circuit queue. This is updated at every new consensus and controlled by a parameter. This default is incorrect and won't be used at all except in unit tests.
Definition at line 3301 of file relay.c.
Referenced by append_cell_to_circuit_queue().
| uint64_t oom_stats_n_bytes_removed_dns = 0 |
Statistics on how many bytes were removed by the OOM per type.
Definition at line 2851 of file relay.c.
Referenced by cell_queues_check_size(), and fill_oom_values().
| uint64_t stats_n_circ_max_cell_reached = 0 |
Stats: how many circuits have we closed due to the cell queue limit being reached (see append_cell_to_circuit_queue())
Definition at line 144 of file relay.c.
Referenced by append_cell_to_circuit_queue(), and fill_dos_values().
| uint64_t stats_n_data_bytes_packaged = 0 |
How many bytes of data have we put in relay_data cells have we built, ever? This would be RELAY_PAYLOAD_SIZE*stats_n_data_cells_packaged if every relay cell we ever sent were completely full of data.
Definition at line 2181 of file relay.c.
Referenced by connection_edge_package_raw_inbuf(), dumpstats(), and log_heartbeat().
| uint64_t stats_n_data_bytes_received = 0 |
How many bytes of data have we received relay_data cells, ever? This would be RELAY_PAYLOAD_SIZE*stats_n_data_cells_packaged if every relay cell we ever received were completely full of data.
Definition at line 2187 of file relay.c.
Referenced by dumpstats(), and handle_relay_msg().
| uint64_t stats_n_data_cells_packaged = 0 |
How many relay_data cells have we built, ever?
Definition at line 2177 of file relay.c.
Referenced by connection_edge_package_raw_inbuf(), dumpstats(), and log_heartbeat().
| uint64_t stats_n_data_cells_received = 0 |
How many relay_data cells have we received, ever?
Definition at line 2183 of file relay.c.
Referenced by dumpstats(), and handle_relay_msg().
| uint64_t stats_n_relay_cells_delivered = 0 |
Stats: how many relay cells have been delivered to streams at this hop?
Definition at line 141 of file relay.c.
Referenced by circuit_receive_relay_cell(), and dumpstats().
| uint64_t stats_n_relay_cells_relayed = 0 |
Stats: how many relay cells have originated at this hop, or have been relayed onward (not recognized at this hop)?
Definition at line 137 of file relay.c.
Referenced by circuit_package_relay_cell(), circuit_receive_relay_cell(), and dumpstats().
|
static |
The total number of cells we have allocated.
Definition at line 2647 of file relay.c.
Referenced by dump_cell_pool_usage(), packed_cell_free_unchecked(), and packed_cell_new().