mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 13:43:47 +01:00
Don't access global_circuitlist variable directly. Use a getter instead.
This commit is contained in:
parent
097f257078
commit
d7538b57b4
@ -46,13 +46,6 @@
|
|||||||
#define MIN(a,b) ((a)<(b)?(a):(b))
|
#define MIN(a,b) ((a)<(b)?(a):(b))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/********* START VARIABLES **********/
|
|
||||||
|
|
||||||
/** A global list of all circuits at this hop. */
|
|
||||||
extern circuit_t *global_circuitlist;
|
|
||||||
|
|
||||||
/********* END VARIABLES ************/
|
|
||||||
|
|
||||||
static channel_t * channel_connect_for_circuit(const tor_addr_t *addr,
|
static channel_t * channel_connect_for_circuit(const tor_addr_t *addr,
|
||||||
uint16_t port,
|
uint16_t port,
|
||||||
const char *id_digest);
|
const char *id_digest);
|
||||||
@ -2181,7 +2174,7 @@ pathbias_count_circs_in_states(entry_guard_t *guard,
|
|||||||
int open_circuits = 0;
|
int open_circuits = 0;
|
||||||
|
|
||||||
/* Count currently open circuits. Give them the benefit of the doubt. */
|
/* Count currently open circuits. Give them the benefit of the doubt. */
|
||||||
for (circ = global_circuitlist; circ; circ = circ->next) {
|
for (circ = circuit_get_global_list_(); circ; circ = circ->next) {
|
||||||
origin_circuit_t *ocirc = NULL;
|
origin_circuit_t *ocirc = NULL;
|
||||||
if (!CIRCUIT_IS_ORIGIN(circ) || /* didn't originate here */
|
if (!CIRCUIT_IS_ORIGIN(circ) || /* didn't originate here */
|
||||||
circ->marked_for_close) /* already counted */
|
circ->marked_for_close) /* already counted */
|
||||||
|
@ -31,12 +31,6 @@
|
|||||||
#include "router.h"
|
#include "router.h"
|
||||||
#include "routerlist.h"
|
#include "routerlist.h"
|
||||||
|
|
||||||
/********* START VARIABLES **********/
|
|
||||||
|
|
||||||
extern circuit_t *global_circuitlist; /* from circuitlist.c */
|
|
||||||
|
|
||||||
/********* END VARIABLES ************/
|
|
||||||
|
|
||||||
static void circuit_expire_old_circuits_clientside(void);
|
static void circuit_expire_old_circuits_clientside(void);
|
||||||
static void circuit_increment_failure_count(void);
|
static void circuit_increment_failure_count(void);
|
||||||
|
|
||||||
@ -286,7 +280,7 @@ circuit_get_best(const entry_connection_t *conn,
|
|||||||
|
|
||||||
tor_gettimeofday(&now);
|
tor_gettimeofday(&now);
|
||||||
|
|
||||||
for (circ=global_circuitlist;circ;circ = circ->next) {
|
for (circ=circuit_get_global_list_();circ;circ = circ->next) {
|
||||||
origin_circuit_t *origin_circ;
|
origin_circuit_t *origin_circ;
|
||||||
if (!CIRCUIT_IS_ORIGIN(circ))
|
if (!CIRCUIT_IS_ORIGIN(circ))
|
||||||
continue;
|
continue;
|
||||||
@ -327,7 +321,7 @@ count_pending_general_client_circuits(void)
|
|||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
for (circ = global_circuitlist; circ; circ = circ->next) {
|
for (circ = circuit_get_global_list_(); circ; circ = circ->next) {
|
||||||
if (circ->marked_for_close ||
|
if (circ->marked_for_close ||
|
||||||
circ->state == CIRCUIT_STATE_OPEN ||
|
circ->state == CIRCUIT_STATE_OPEN ||
|
||||||
circ->purpose != CIRCUIT_PURPOSE_C_GENERAL ||
|
circ->purpose != CIRCUIT_PURPOSE_C_GENERAL ||
|
||||||
@ -375,7 +369,7 @@ circuit_conforms_to_options(const origin_circuit_t *circ,
|
|||||||
void
|
void
|
||||||
circuit_expire_building(void)
|
circuit_expire_building(void)
|
||||||
{
|
{
|
||||||
circuit_t *victim, *next_circ = global_circuitlist;
|
circuit_t *victim, *next_circ = circuit_get_global_list_();
|
||||||
/* circ_times.timeout_ms and circ_times.close_ms are from
|
/* circ_times.timeout_ms and circ_times.close_ms are from
|
||||||
* circuit_build_times_get_initial_timeout() if we haven't computed
|
* circuit_build_times_get_initial_timeout() if we haven't computed
|
||||||
* custom timeouts yet */
|
* custom timeouts yet */
|
||||||
@ -410,7 +404,7 @@ circuit_expire_building(void)
|
|||||||
}
|
}
|
||||||
next_circ = next_circ->next;
|
next_circ = next_circ->next;
|
||||||
}
|
}
|
||||||
next_circ = global_circuitlist;
|
next_circ = circuit_get_global_list_();
|
||||||
|
|
||||||
#define SET_CUTOFF(target, msec) do { \
|
#define SET_CUTOFF(target, msec) do { \
|
||||||
long ms = tor_lround(msec); \
|
long ms = tor_lround(msec); \
|
||||||
@ -818,7 +812,7 @@ circuit_stream_is_being_handled(entry_connection_t *conn,
|
|||||||
get_options()->LongLivedPorts,
|
get_options()->LongLivedPorts,
|
||||||
conn ? conn->socks_request->port : port);
|
conn ? conn->socks_request->port : port);
|
||||||
|
|
||||||
for (circ=global_circuitlist;circ;circ = circ->next) {
|
for (circ=circuit_get_global_list_();circ;circ = circ->next) {
|
||||||
if (CIRCUIT_IS_ORIGIN(circ) &&
|
if (CIRCUIT_IS_ORIGIN(circ) &&
|
||||||
!circ->marked_for_close &&
|
!circ->marked_for_close &&
|
||||||
circ->purpose == CIRCUIT_PURPOSE_C_GENERAL &&
|
circ->purpose == CIRCUIT_PURPOSE_C_GENERAL &&
|
||||||
@ -869,7 +863,7 @@ circuit_predict_and_launch_new(void)
|
|||||||
int flags = 0;
|
int flags = 0;
|
||||||
|
|
||||||
/* First, count how many of each type of circuit we have already. */
|
/* First, count how many of each type of circuit we have already. */
|
||||||
for (circ=global_circuitlist;circ;circ = circ->next) {
|
for (circ=circuit_get_global_list_();circ;circ = circ->next) {
|
||||||
cpath_build_state_t *build_state;
|
cpath_build_state_t *build_state;
|
||||||
origin_circuit_t *origin_circ;
|
origin_circuit_t *origin_circ;
|
||||||
if (!CIRCUIT_IS_ORIGIN(circ))
|
if (!CIRCUIT_IS_ORIGIN(circ))
|
||||||
@ -1093,7 +1087,7 @@ circuit_expire_old_circuits_clientside(void)
|
|||||||
cutoff.tv_sec -= get_options()->CircuitIdleTimeout;
|
cutoff.tv_sec -= get_options()->CircuitIdleTimeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (circ = global_circuitlist; circ; circ = circ->next) {
|
for (circ = circuit_get_global_list_(); circ; circ = circ->next) {
|
||||||
if (circ->marked_for_close || !CIRCUIT_IS_ORIGIN(circ))
|
if (circ->marked_for_close || !CIRCUIT_IS_ORIGIN(circ))
|
||||||
continue;
|
continue;
|
||||||
/* If the circuit has been dirty for too long, and there are no streams
|
/* If the circuit has been dirty for too long, and there are no streams
|
||||||
@ -1176,7 +1170,7 @@ circuit_expire_old_circuits_serverside(time_t now)
|
|||||||
or_circuit_t *or_circ;
|
or_circuit_t *or_circ;
|
||||||
time_t cutoff = now - IDLE_ONE_HOP_CIRC_TIMEOUT;
|
time_t cutoff = now - IDLE_ONE_HOP_CIRC_TIMEOUT;
|
||||||
|
|
||||||
for (circ = global_circuitlist; circ; circ = circ->next) {
|
for (circ = circuit_get_global_list_(); circ; circ = circ->next) {
|
||||||
if (circ->marked_for_close || CIRCUIT_IS_ORIGIN(circ))
|
if (circ->marked_for_close || CIRCUIT_IS_ORIGIN(circ))
|
||||||
continue;
|
continue;
|
||||||
or_circ = TO_OR_CIRCUIT(circ);
|
or_circ = TO_OR_CIRCUIT(circ);
|
||||||
@ -1223,7 +1217,7 @@ circuit_enough_testing_circs(void)
|
|||||||
if (have_performed_bandwidth_test)
|
if (have_performed_bandwidth_test)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
for (circ = global_circuitlist; circ; circ = circ->next) {
|
for (circ = circuit_get_global_list_(); circ; circ = circ->next) {
|
||||||
if (!circ->marked_for_close && CIRCUIT_IS_ORIGIN(circ) &&
|
if (!circ->marked_for_close && CIRCUIT_IS_ORIGIN(circ) &&
|
||||||
circ->purpose == CIRCUIT_PURPOSE_TESTING &&
|
circ->purpose == CIRCUIT_PURPOSE_TESTING &&
|
||||||
circ->state == CIRCUIT_STATE_OPEN)
|
circ->state == CIRCUIT_STATE_OPEN)
|
||||||
|
Loading…
Reference in New Issue
Block a user