main.c File Reference

Toplevel module. Handles signals, multiplexes between connections, implements main loop, and drives scheduled events. More...

#include "or.h"
#include "memarea.h"
#include <event.h>

Defines

#define MAIN_PRIVATE
#define MAX_SIGNEWNYM_RATE   10
#define GREEDY_DESCRIPTOR_RETRY_INTERVAL   (10)
#define LAZY_DESCRIPTOR_RETRY_INTERVAL   (60)
#define DESCRIPTOR_FAILURE_RESET_INTERVAL   (60*60)
#define DIR_CONN_MAX_STALL   (5*60)
#define TLS_HANDSHAKE_TIMEOUT   (60)
#define IDLE_OR_CONN_TIMEOUT   180
#define ENTROPY_INTERVAL   (60*60)
#define SAVE_STABILITY_INTERVAL   (30*60)
#define CHECK_V3_CERTIFICATE_INTERVAL   (5*60)
#define NS_EXPIRY_SLOP   (24*60*60)
#define CHECK_EXPIRED_NS_INTERVAL   (2*60)
#define WRITE_STATS_INTERVAL   (24*60*60)
#define CLEAN_CACHES_INTERVAL   (30*60)
#define RETRY_DNS_INTERVAL   (10*60)
#define CHECK_DESCRIPTOR_INTERVAL   (60)
#define CHECK_IPADDRESS_INTERVAL   (15*60)
#define FORCE_REGENERATE_DESCRIPTOR_INTERVAL   (18*60*60)
#define BANDWIDTH_RECHECK_INTERVAL   (12*60*60)
#define MEM_SHRINK_INTERVAL   (60)
#define BRIDGE_STATUSFILE_INTERVAL   (30*60)
#define NUM_JUMPED_SECONDS_BEFORE_WARN   100
#define UPTIME_CUTOFF_FOR_NEW_BANDWIDTH_TEST   (6*60*60)

Functions

void evdns_shutdown (int)
static void dumpmemusage (int severity)
static void dumpstats (int severity)
static void conn_read_callback (int fd, short event, void *_conn)
static void conn_write_callback (int fd, short event, void *_conn)
static void signal_callback (int fd, short events, void *arg)
static void second_elapsed_callback (int fd, short event, void *args)
static int conn_close_if_marked (int i)
static void connection_start_reading_from_linked_conn (connection_t *conn)
static int connection_should_read_from_linked_conn (connection_t *conn)
int connection_add (connection_t *conn)
void connection_unregister_events (connection_t *conn)
int connection_remove (connection_t *conn)
static void connection_unlink (connection_t *conn)
void add_connection_to_closeable_list (connection_t *conn)
int connection_is_on_closeable_list (connection_t *conn)
int connection_in_array (connection_t *conn)
smartlist_tget_connection_array (void)
void connection_watch_events (connection_t *conn, watchable_events_t events)
int connection_is_reading (connection_t *conn)
void connection_stop_reading (connection_t *conn)
void connection_start_reading (connection_t *conn)
int connection_is_writing (connection_t *conn)
void connection_stop_writing (connection_t *conn)
void connection_start_writing (connection_t *conn)
void connection_stop_reading_from_linked_conn (connection_t *conn)
static void close_closeable_connections (void)
void directory_all_unreachable (time_t now)
void directory_info_has_arrived (time_t now, int from_cache)
static void run_connection_housekeeping (int i, time_t now)
static void signewnym_impl (time_t now)
static void run_scheduled_events (time_t now)
static int got_libevent_error (void)
void ip_address_changed (int at_interface)
void dns_servers_relaunch_checks (void)
static int do_hup (void)
int do_main_loop (void)
void control_signal_act (int the_signal)
static void exit_function (void)
void handle_signals (int is_parent)
int tor_init (int argc, char *argv[])
int try_locking (or_options_t *options, int err_if_locked)
int have_lockfile (void)
void release_lockfile (void)
void tor_free_all (int postfork)
void tor_cleanup (void)
int do_list_fingerprint (void)
void do_hash_password (void)
int tor_main (int argc, char *argv[])

Variables

int global_read_bucket
int global_write_bucket
int global_relayed_read_bucket
int global_relayed_write_bucket
static int stats_prev_global_read_bucket
static int stats_prev_global_write_bucket
static uint64_t stats_n_bytes_read = 0
static uint64_t stats_n_bytes_written = 0
time_t time_of_process_start = 0
long stats_n_seconds_working = 0
static time_t time_to_check_for_correct_dns = 0
static time_t time_of_last_signewnym = 0
static int signewnym_is_pending = 0
static smartlist_tconnection_array = NULL
static smartlist_tcloseable_connection_lst = NULL
static smartlist_tactive_linked_connection_lst = NULL
static int called_loop_once = 0
int has_completed_circuit = 0
static struct event * timeout_event = NULL
static int n_libevent_errors = 0
uint64_t rephist_total_alloc
uint32_t rephist_total_num
static tor_lockfile_tlockfile = NULL


Detailed Description

Toplevel module. Handles signals, multiplexes between connections, implements main loop, and drives scheduled events.


Define Documentation

#define DESCRIPTOR_FAILURE_RESET_INTERVAL   (60*60)

How often do we 'forgive' undownloadable router descriptors and attempt to download them again?

Referenced by run_scheduled_events().

#define DIR_CONN_MAX_STALL   (5*60)

How long do we let a directory connection stall before expiring it?

Referenced by run_connection_housekeeping().

#define GREEDY_DESCRIPTOR_RETRY_INTERVAL   (10)

How often do we check for router descriptors that we should download when we have too little directory info?

Referenced by run_scheduled_events().

#define IDLE_OR_CONN_TIMEOUT   180

How long do we wait before killing OR connections with no circuits? In Tor versions up to 0.2.1.25 and 0.2.2.12-alpha, we waited 15 minutes before cancelling these connections, which caused fast relays to accrue many many idle connections. Hopefully 3 minutes is low enough that it kills most idle connections, without being so low that we cause clients to bounce on and off.

Referenced by run_connection_housekeeping().

#define LAZY_DESCRIPTOR_RETRY_INTERVAL   (60)

How often do we check for router descriptors that we should download when we have enough directory info?

Referenced by run_scheduled_events().

#define MAX_SIGNEWNYM_RATE   10

How often will we honor SIGNEWNYM requests?

Referenced by run_scheduled_events(), and signal_callback().

#define TLS_HANDSHAKE_TIMEOUT   (60)

How long do we let OR connections handshake before we decide that they are obsolete?


Function Documentation

void add_connection_to_closeable_list ( connection_t conn  ) 

static void close_closeable_connections ( void   )  [static]

Close all connections that have been scheduled to get closed.

References connection_t::conn_array_index, conn_close_if_marked(), and connection_unlink().

Referenced by conn_read_callback(), conn_write_callback(), and run_scheduled_events().

static int conn_close_if_marked ( int  i  )  [static]

If the connection at connection_array[i] is marked for close, then:

  • If it has data that it wants to flush, try to flush it.
  • If it _still_ has data to flush, and conn->hold_open_until_flushed is true, then leave the connection open and return.
  • Otherwise, remove the connection from connection_array and from all other lists, close it, and free it. Returns 1 if the connection was closed, 0 otherwise.

References connection_t::address, assert_connection_ok(), buf_datalen(), CONN_TYPE_DIR, CONN_TYPE_EXIT, CONN_TYPE_OR, conn_type_to_string(), connection_bucket_write_limit(), connection_start_reading_from_linked_conn(), connection_unlink(), connection_wants_to_flush(), DIR_PURPOSE_SERVER, escaped_safe_str_client(), flush_buf(), flush_buf_tls(), get_options(), connection_t::hold_open_until_flushed, connection_t::inbuf, LD_GENERAL, LD_NET, connection_t::linked_conn, LOG_FN_CONN, connection_t::marked_for_close, connection_t::marked_for_close_file, move_buf_to_buf(), OR_CONN_STATE_OPEN, connection_t::outbuf, connection_t::outbuf_flushlen, connection_t::purpose, connection_t::s, server_mode(), connection_t::state, connection_t::timestamp_lastwritten, TO_OR_CONN(), and connection_t::type.

Referenced by close_closeable_connections().

static void conn_read_callback ( int  fd,
short  event,
void *  _conn 
) [static]

static void conn_write_callback ( int  fd,
short  events,
void *  _conn 
) [static]

int connection_add ( connection_t conn  ) 

int connection_in_array ( connection_t conn  ) 

Return true iff conn is in the current poll array.

References smartlist_isin().

Referenced by assert_all_pending_dns_resolves_ok(), and connection_free().

int connection_is_on_closeable_list ( connection_t conn  ) 

Return 1 if conn is on the closeable list, else return 0.

References smartlist_isin().

Referenced by connection_free().

int connection_is_reading ( connection_t conn  ) 

int connection_is_writing ( connection_t conn  ) 

Return true iff conn is listening for write events.

References tor_assert, connection_t::write_event, and connection_t::writing_to_linked_conn.

Referenced by assert_connection_ok(), and connection_read_to_buf().

int connection_remove ( connection_t conn  ) 

Remove the connection from the global list, and remove the corresponding poll entry. Calling this function will shift the last connection (if any) into the position occupied by conn.

References connection_t::conn_array_index, conn_type_to_string(), connection_unregister_events(), LD_NET, connection_t::s, smartlist_del(), tor_assert, and connection_t::type.

Referenced by connection_unlink().

static int connection_should_read_from_linked_conn ( connection_t conn  )  [static]

Return true iff conn is linked conn, and reading from the conn linked to it would be good and feasible. (Reading is "feasible" if the other conn exists and has data in its outbuf, and is "good" if we have our reading_from_linked_conn flag set and the other conn has its writing_to_linked_conn flag set.)

References buf_datalen(), connection_t::linked, connection_t::linked_conn, connection_t::outbuf, connection_t::reading_from_linked_conn, and connection_t::writing_to_linked_conn.

Referenced by connection_start_reading(), and connection_start_writing().

void connection_start_reading ( connection_t conn  ) 

static void connection_start_reading_from_linked_conn ( connection_t conn  )  [static]

Helper: Tell the main loop to begin reading bytes into conn from its linked connection, if it is not doing so already. Called by connection_start_reading and connection_start_writing as appropriate.

References connection_t::active_on_link, called_loop_once, connection_t::linked, smartlist_add(), smartlist_isin(), tor_assert, and tor_libevent_get_base().

Referenced by conn_close_if_marked(), connection_start_reading(), and connection_start_writing().

void connection_start_writing ( connection_t conn  ) 

void connection_stop_reading ( connection_t conn  ) 

void connection_stop_reading_from_linked_conn ( connection_t conn  ) 

Tell the main loop to stop reading bytes into conn from its linked connection, if is currently doing so. Called by connection_stop_reading, connection_stop_writing, and connection_read.

References connection_t::active_on_link, connection_t::linked, smartlist_isin(), smartlist_remove(), and tor_assert.

Referenced by connection_handle_read_impl(), connection_stop_reading(), and connection_stop_writing().

void connection_stop_writing ( connection_t conn  ) 

static void connection_unlink ( connection_t conn  )  [static]

If conn is an edge conn, remove it from the list of conn's on this circuit. If it's not on an edge, flush and send destroys for all circuits on this conn.

Remove it from connection_array (if applicable) and from closeable_connection_list.

Then free it.

References assert_connection_edge_not_dns_pending(), connection_t::conn_array_index, CONN_TYPE_EXIT, CONN_TYPE_OR, connection_about_to_close_connection(), connection_free(), connection_or_remove_from_identity_map(), connection_remove(), connection_start_reading(), connection_t::linked_conn, connection_t::marked_for_close, connection_t::reading_from_linked_conn, smartlist_remove(), TO_EDGE_CONN(), TO_OR_CONN(), tor_digest_is_zero(), and connection_t::type.

Referenced by close_closeable_connections(), and conn_close_if_marked().

void connection_unregister_events ( connection_t conn  ) 

void connection_watch_events ( connection_t conn,
watchable_events_t  events 
)

Set the event mask on conn to events. (The event mask is a bitmask whose bits are READ_EVENT and WRITE_EVENT)

References connection_start_reading(), connection_start_writing(), connection_stop_reading(), and connection_stop_writing().

Referenced by connection_edge_finished_connecting(), connection_exit_connect(), connection_or_connect(), and directory_initiate_command_rend().

void control_signal_act ( int  the_signal  ) 

Used to implement the SIGNAL control command: if we accept the_signal as a remote pseudo-signal, act on it.

References LD_BUG, and signal_callback().

Referenced by handle_control_signal().

void directory_all_unreachable ( time_t  now  ) 

We've just tried every dirserver we know about, and none of them were reachable. Assume the network is down. Change state so next time an application connection arrives we'll delay it and try another directory fetch. Kill off all the circuit_wait streams that are waiting now, since they will all timeout anyway.

References socks_request_t::address, AP_CONN_STATE_CIRCUIT_WAIT, CONN_TYPE_AP, connection_get_by_type_state(), control_event_general_status(), END_STREAM_REASON_NET_UNREACHABLE, LD_NET, socks_request_t::port, safe_str_client(), edge_connection_t::socks_request, stats_n_seconds_working, and TO_EDGE_CONN().

Referenced by directory_get_from_dirserver().

void directory_info_has_arrived ( time_t  now,
int  from_cache 
)

void dns_servers_relaunch_checks ( void   ) 

Forget what we've learned about the correctness of our DNS servers, and start learning again.

References dns_reset_correctness_checks(), get_options(), server_mode(), and time_to_check_for_correct_dns.

Referenced by configure_nameservers(), and ip_address_changed().

void do_hash_password ( void   ) 

Entry point for password hashing: take the desired password from the command line, and print its salted hash to stdout.

References base16_encode(), crypto_rand(), DIGEST_LEN, get_options(), S2K_SPECIFIER_LEN, and secret_to_key().

Referenced by tor_main().

static int do_hup ( void   )  [static]

int do_list_fingerprint ( void   ) 

Read/create keys as needed, and echo our fingerprint to stdout.

References crypto_pk_get_fingerprint(), FINGERPRINT_LEN, get_identity_key(), get_options(), init_keys(), LD_BUG, LD_GENERAL, or_options_t::Nickname, server_mode(), and tor_assert.

Referenced by tor_main().

int do_main_loop ( void   ) 

static void dumpmemusage ( int  severity  )  [static]

static void dumpstats ( int  severity  )  [static]

static void exit_function ( void   )  [static]

Called by exit() as we shut down the process.

Referenced by tor_init().

smartlist_t* get_connection_array ( void   ) 

static int got_libevent_error ( void   )  [static]

Called when a possibly ignorable libevent error occurs; ensures that we don't get into an infinite loop by ignoring too many errors from libevent.

References LD_NET, and n_libevent_errors.

Referenced by do_main_loop().

void handle_signals ( int  is_parent  ) 

Set up the signal handlers for either parent or child.

References LD_BUG, signal_callback(), tor_evsignal_new(), and tor_libevent_get_base().

Referenced by cpuworker_main(), and do_main_loop().

int have_lockfile ( void   ) 

Return true iff we've successfully acquired the lock file.

Referenced by init_key_from_file(), and options_act().

void ip_address_changed ( int  at_interface  ) 

Called when our IP address seems to have changed. at_interface should be true if we detected a change in our interface, and false if we detected a change in our published address.

References dns_servers_relaunch_checks(), get_options(), init_keys(), mark_my_descriptor_dirty(), reset_bandwidth_test(), router_reset_reachability(), server_mode(), and stats_n_seconds_working.

Referenced by check_descriptor_ipaddress_changed(), client_check_address_changed(), options_act(), resolve_my_address(), and router_new_address_suggestion().

void release_lockfile ( void   ) 

If we have successfully acquired the lock file, release it.

References tor_lockfile_unlock().

Referenced by tor_free_all().

static void run_connection_housekeeping ( int  i,
time_t  now 
) [static]

static void run_scheduled_events ( time_t  now  )  [static]

Perform regular maintenance tasks. This function gets run once per second by second_elapsed_callback().

0. See if we've been asked to shut down and our timeout has expired; or if our bandwidth limits are exhausted and we should hibernate; or if it's time to wake up from hibernation.

1a. Every MIN_ONION_KEY_LIFETIME seconds, rotate the onion keys, shut down and restart all cpuworkers, and update the directory if necessary.

1b. Every MAX_SSL_KEY_LIFETIME seconds, we change our TLS context.

How often do we add more entropy to OpenSSL's RNG pool?

1c. If we have to change the accounting interval or record bandwidth used in this accounting interval, do so.

1d. Periodically, we discount older stability information so that new stability info counts more, and save the stability information to disk as appropriate.

2. Periodically, we consider force-uploading our descriptor (if we've passed our internal checks).

How often do we check whether part of our router info has changed in a way that would require an upload?

How often do we (as a router) check whether our IP address has changed?

If our router descriptor ever goes this long without being regenerated because something changed, we force an immediate regenerate-and-upload.

2c. Let directory voting happen.

3a. Every second, we examine pending circuits and prune the ones which have been pending for more than a few seconds. We do this before step 4, so it can try building more if it's not comfortable with the number of available circuits.

3b. Also look at pending streams and prune the ones that 'began' a long time ago but haven't gotten a 'connected' yet. Do this before step 4, so we can put them back into pending state to be picked up by the new circuit.

3c. And expire connections that we've held open for too long.

3d. And every 60 seconds, we relaunch listeners if any died.

4. Every second, we try a new circuit if there are no valid circuits. Every NewCircuitPeriod seconds, we expire circuits that became dirty more than MaxCircuitDirtiness seconds ago, and we make a new circ if there are no clean circuits.

5. We do housekeeping for each connection...

How often do we check buffers and pools for empty space that can be deallocated?

6. And remove any marked circuits...

7. And upload service descriptors if necessary.

8. and blow away any connections that need to die. have to do this now, because if we marked a conn for close and left its socket -1, then we'll pass it to poll/select and bad things will happen.

8b. And if anything in our state is ready to get flushed to disk, we flush it.

9. and if we're a server, check whether our DNS is telling stories to us.

10b. write bridge networkstatus file to disk

References accounting_is_enabled(), accounting_run_housekeeping(), advertised_server_mode(), any_predicted_circuits(), authdir_mode_tests_reachability(), authdir_mode_v3(), routerinfo_t::bandwidthcapacity, routerinfo_t::bandwidthrate, or_options_t::BridgeAuthoritativeDir, buf_shrink(), buf_shrink_freelists(), or_options_t::CellStatistics, check_descriptor_bandwidth_changed(), check_descriptor_ipaddress_changed(), circuit_build_needed_circs(), circuit_close_all_marked(), circuit_expire_building(), circuit_expire_old_circuits_serverside(), clean_cell_pool(), close_closeable_connections(), connection_ap_expire_beginning(), connection_expire_held_open(), connection_or_set_bad_connections(), consider_hibernation(), consider_publishable_server(), consider_testing_reachability(), cpuworkers_rotate(), crypto_rand_int(), crypto_seed_rng(), DESCRIPTOR_FAILURE_RESET_INTERVAL, or_options_t::DirReqStatistics, dirserv_test_reachability(), dirvote_act(), dns_init(), dns_launch_correctness_checks(), or_options_t::EntryStatistics, or_options_t::ExitPortStatistics, fetch_bridge_descriptors(), geoip_bridge_stats_init(), geoip_bridge_stats_write(), geoip_dirreq_stats_init(), geoip_dirreq_stats_write(), geoip_entry_stats_init(), geoip_entry_stats_write(), get_identity_key(), get_onion_key_set_at(), get_options(), GREEDY_DESCRIPTOR_RETRY_INTERVAL, has_completed_circuit, has_dns_init_failed(), LAZY_DESCRIPTOR_RETRY_INTERVAL, LD_BUG, LD_CONFIG, LD_CONTROL, LD_GENERAL, mark_my_descriptor_dirty_if_older_than(), MAX_SIGNEWNYM_RATE, MAX_SSL_KEY_LIFETIME, MIN_ONION_KEY_LIFETIME, networkstatus_dump_bridge_status_to_file(), networkstatus_get_latest_consensus(), networkstatus_v2_list_clean(), or_state_save(), rend_cache_clean(), rend_cache_clean_v2_descs_as_dir(), rend_consider_descriptor_republication(), rend_consider_services_upload(), rep_hist_buffer_stats_init(), rep_hist_buffer_stats_write(), rep_hist_downrate_old_runs(), rep_hist_exit_stats_init(), rep_hist_exit_stats_write(), rep_hist_record_mtbf_data(), rep_history_clean(), or_options_t::RephistTrackTime, reset_bandwidth_test(), retry_all_listeners(), rotate_onion_key(), router_dir_info_changed(), router_get_my_routerinfo(), router_have_minimum_dir_info(), router_rebuild_descriptor(), router_reset_descriptor_download_failures(), router_upload_dir_desc_to_dirservers(), routerlist_remove_old_routers(), run_connection_housekeeping(), server_mode(), should_record_bridge_info(), signewnym_impl(), signewnym_is_pending, stats_n_seconds_working, time_of_last_signewnym, time_to_check_for_correct_dns, TIMEOUT_UNTIL_UNREACHABILITY_COMPLAINT, tor_tls_context_new(), update_extrainfo_downloads(), update_networkstatus_downloads(), update_router_descriptor_downloads(), or_options_t::UseBridges, v3_authority_check_key_expiry(), networkstatus_t::valid_until, and we_are_hibernating().

Referenced by second_elapsed_callback().

static void second_elapsed_callback ( int  fd,
short  event,
void *  args 
) [static]

static void signal_callback ( int  fd,
short  events,
void *  arg 
) [static]

static void signewnym_impl ( time_t  now  )  [static]

Honor a NEWNYM request: make future requests unlinkable to past requests.

References addressmap_clear_transient(), circuit_expire_all_dirty_circs(), signewnym_is_pending, and time_of_last_signewnym.

Referenced by run_scheduled_events(), and signal_callback().

void tor_cleanup ( void   ) 

void tor_free_all ( int  postfork  ) 

Free all memory that we might have allocated somewhere. If postfork, we are a worker process and we want to free only the parts of memory that we won't touch. If !postfork, Tor is shutting down and we should free everything.

Helps us find the real leaks with dmalloc and the like. Also valgrind should then report 0 reachable in its leak report (in an ideal world -- in practice libevent, SSL, libc etc never quite free everything).

References addressmap_free_all(), buf_shrink_freelists(), circuit_free_all(), clear_pending_onions(), config_free_all(), connection_free_all(), dirserv_free_all(), dirvote_free_all(), dns_free_all(), entry_guards_free_all(), esc_router_info(), escaped(), free_cell_pool(), geoip_free_all(), logs_free_all(), memarea_clear_freelist(), networkstatus_free_all(), policies_free_all(), release_lockfile(), rend_cache_free_all(), rend_service_authorization_free_all(), rend_service_free_all(), rep_hist_free_all(), router_free_all(), routerlist_free_all(), smartlist_free(), timeout_event, tor_free, and tor_tls_free_all().

Referenced by cpuworker_main(), and tor_cleanup().

int tor_init ( int  argc,
char *  argv[] 
)

int tor_main ( int  argc,
char *  argv[] 
)

int try_locking ( or_options_t options,
int  err_if_locked 
)

Try to grab the lock file described in options, if we do not already have it. If err_if_locked is true, warn if somebody else is holding the lock, and exit if we can't get it after waiting. Otherwise, return -1 if we can't get the lockfile. Return 0 on success.

References LD_GENERAL, options_get_datadir_fname2_suffix(), tor_free, tor_lockfile_lock(), and try_locking().

Referenced by init_key_from_file(), options_act(), and try_locking().


Variable Documentation

List of linked connections that are currently reading data into their inbuf from their partner's outbuf.

int called_loop_once = 0 [static]

Flag: Set to true iff we entered the current libevent main loop via loop_once. If so, there's no need to trigger a loopexit in order to handle linked connections.

Referenced by connection_start_reading_from_linked_conn(), and do_main_loop().

List of connections that have been marked for close and need to be freed and removed from connection_array.

smartlist_t* connection_array = NULL [static]

Smartlist of all open connections.

Max number of bytes I can read this second.

Referenced by do_main_loop(), and second_elapsed_callback().

Max number of relayed (bandwidth class 1) bytes I can read this second.

Max number of relayed (bandwidth class 1) bytes I can write this second.

Max number of bytes I can write this second.

Referenced by do_main_loop(), and second_elapsed_callback().

We set this to 1 when we've opened a circuit, so we can print a log entry to inform the user that Tor is working.

Referenced by circuit_note_clock_jumped(), circuit_send_next_onion_skin(), directory_info_has_arrived(), getinfo_helper_events(), options_act(), purpose_needs_anonymity(), run_scheduled_events(), and second_elapsed_callback().

tor_lockfile_t* lockfile = NULL [static]

A lockfile structure, used to prevent two Tors from messing with the data directory at once. If this variable is non-NULL, we're holding the lockfile.

int n_libevent_errors = 0 [static]

Number of libevent errors in the last second: we die if we get too many.

Referenced by got_libevent_error(), and second_elapsed_callback().

Number of or_history_t objects currently allocated.

Referenced by dumpmemusage(), free_or_history(), and get_or_history().

int signewnym_is_pending = 0 [static]

Is there a signewnym request we're currently waiting to handle?

Referenced by run_scheduled_events(), signal_callback(), and signewnym_impl().

uint64_t stats_n_bytes_read = 0 [static]

How many bytes have we read since we started the process?

Referenced by dumpstats(), and second_elapsed_callback().

uint64_t stats_n_bytes_written = 0 [static]

How many bytes have we written since we started the process?

Referenced by dumpstats(), and second_elapsed_callback().

What was the read bucket before the last second_elapsed_callback() call? (used to determine how many bytes we've read).

Referenced by do_main_loop(), and second_elapsed_callback().

What was the write bucket before the last second_elapsed_callback() call? (used to determine how many bytes we've written).

Referenced by do_main_loop(), and second_elapsed_callback().

time_t time_of_last_signewnym = 0 [static]

When did we last process a SIGNEWNYM request?

Referenced by run_scheduled_events(), signal_callback(), and signewnym_impl().

What time did this process start up?

Referenced by dumpstats(), and tor_init().

time_t time_to_check_for_correct_dns = 0 [static]

When do we next launch DNS wildcarding checks?

Referenced by dns_servers_relaunch_checks(), and run_scheduled_events().

struct event* timeout_event = NULL [static]

Libevent timer: used to invoke second_elapsed_callback() once per second.

Referenced by second_elapsed_callback(), and tor_free_all().


Generated on Tue May 25 00:30:44 2010 for tor by  doxygen 1.5.6