Tor
0.4.7.0-alpha-dev
|
Functions to queue create cells for processing. More...
#include "core/or/or.h"
#include "feature/relay/onion_queue.h"
#include "app/config/config.h"
#include "core/mainloop/cpuworker.h"
#include "core/or/circuitlist.h"
#include "core/or/onion.h"
#include "feature/nodelist/networkstatus.h"
#include "feature/stats/rephist.h"
#include "core/or/or_circuit_st.h"
Go to the source code of this file.
Data Structures | |
struct | onion_queue_t |
Macros | |
#define | ONIONQUEUE_WAIT_CUTOFF 5 |
#define | WARN_TOO_MANY_CIRC_CREATIONS_INTERVAL (60) |
#define | DEFAULT_NUM_NTORS_PER_TAP 10 |
#define | MIN_NUM_NTORS_PER_TAP 1 |
#define | MAX_NUM_NTORS_PER_TAP 100000 |
Typedefs | |
typedef struct onion_queue_head_t | onion_queue_head_t |
Functions | |
TOR_TAILQ_HEAD (onion_queue_head_t, onion_queue_t) | |
static int | num_ntors_per_tap (void) |
static void | onion_queue_entry_remove (onion_queue_t *victim) |
static int | have_room_for_onionskin (uint16_t type) |
int | onion_pending_add (or_circuit_t *circ, create_cell_t *onionskin) |
static uint16_t | decide_next_handshake_type (void) |
or_circuit_t * | onion_next_task (create_cell_t **onionskin_out) |
int | onion_num_pending (uint16_t handshake_type) |
void | onion_pending_remove (or_circuit_t *circ) |
void | clear_pending_onions (void) |
Variables | |
static onion_queue_head_t | ol_list [MAX_ONION_HANDSHAKE_TYPE+1] |
static int | ol_entries [MAX_ONION_HANDSHAKE_TYPE+1] |
Functions to queue create cells for processing.
Relays invoke these functions when they receive a CREATE or EXTEND cell in command.c or relay.c, in order to queue the pending request. They also invoke them from cpuworker.c, which handles dispatching onionskin requests to different worker threads.
This module also handles:
Definition in file onion_queue.c.
#define ONIONQUEUE_WAIT_CUTOFF 5 |
5 seconds on the onion queue til we just send back a destroy
Definition at line 51 of file onion_queue.c.
void clear_pending_onions | ( | void | ) |
Remove all circuits from the pending list. Called from tor_free_all.
Definition at line 359 of file onion_queue.c.
|
static |
Choose which onion queue we'll pull from next. If one is empty choose the other; if they both have elements, load balance across them but favoring NTOR.
Definition at line 235 of file onion_queue.c.
Referenced by onion_next_task().
|
static |
Return true iff we have room to queue another onionskin of type type.
Definition at line 80 of file onion_queue.c.
|
static |
Return a fairness parameter, to prefer processing NTOR style handshakes but still slowly drain the TAP queue so we don't starve it entirely.
Definition at line 217 of file onion_queue.c.
or_circuit_t* onion_next_task | ( | create_cell_t ** | onionskin_out | ) |
Remove the highest priority item from ol_list[] and return it, or return NULL if the lists are empty.
Definition at line 275 of file onion_queue.c.
int onion_num_pending | ( | uint16_t | handshake_type | ) |
Return the number of handshake_type-style create requests pending.
Definition at line 307 of file onion_queue.c.
int onion_pending_add | ( | or_circuit_t * | circ, |
create_cell_t * | onionskin | ||
) |
Add circ to the end of ol_list and return 0, except if ol_list is too long, in which case do nothing and return -1.
Definition at line 143 of file onion_queue.c.
void onion_pending_remove | ( | or_circuit_t * | circ | ) |
Go through ol_list, find the onion_queue_t element which points to circ, remove and free that element. Leave circ itself alone.
Definition at line 316 of file onion_queue.c.
Referenced by circuit_about_to_free().
|
static |
Remove a queue entry victim from the queue, unlinking it from its circuit and freeing it and any structures it owns.
Definition at line 333 of file onion_queue.c.
Referenced by onion_pending_remove().
|
static |
Number of entries of each type currently in each element of ol_list[].
Definition at line 65 of file onion_queue.c.
Referenced by decide_next_handshake_type(), and onion_num_pending().
|
static |
Array of queues of circuits waiting for CPU workers. An element is NULL if that queue is empty.
Definition at line 58 of file onion_queue.c.
Referenced by onion_next_task().