diff options
author | teor <teor2345@gmail.com> | 2014-12-26 00:10:40 +1100 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-12-30 09:06:00 -0500 |
commit | 9b2d106e49ba4ea12f31af9cea02910869f19a4b (patch) | |
tree | 3b8854cded259d349abfa6a30e5197550fbb862d /src/or/nodelist.h | |
parent | d812baf54c7539d1b7be26aaa3890697c618c0a6 (diff) | |
download | tor-9b2d106e49ba4ea12f31af9cea02910869f19a4b.tar.gz tor-9b2d106e49ba4ea12f31af9cea02910869f19a4b.zip |
Check if there are exits in the consensus
Add router_have_consensus_path() which reports whether
the consensus has exit paths, internal paths, or whether it
just doesn't know.
Used by #13718 and #13814.
Diffstat (limited to 'src/or/nodelist.h')
-rw-r--r-- | src/or/nodelist.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/or/nodelist.h b/src/or/nodelist.h index 48b0e94be0..56cfffa9f1 100644 --- a/src/or/nodelist.h +++ b/src/or/nodelist.h @@ -80,6 +80,28 @@ int router_exit_policy_all_nodes_reject(const tor_addr_t *addr, uint16_t port, int need_uptime); void router_set_status(const char *digest, int up); int router_have_minimum_dir_info(void); + +/** Set to CONSENSUS_PATH_EXIT if there is at least one exit node + * in the consensus. We update this flag in compute_frac_paths_available if + * there is at least one relay that has an Exit flag in the consensus. + * Used to avoid building exit circuits when they will almost certainly fail. + * Set to CONSENSUS_PATH_INTERNAL if there are no exits in the consensus. + * (This situation typically occurs during bootstrap of a test network.) + * Set to CONSENSUS_PATH_UNKNOWN if we have never checked, or have + * reason to believe our last known value was invalid or has expired. + */ +typedef enum { + /* we haven't checked yet, or we have invalidated our previous check */ + CONSENSUS_PATH_UNKNOWN = -1, + /* The consensus only has internal relays, and we should only + * create internal paths, circuits, streams, ... */ + CONSENSUS_PATH_INTERNAL = 0, + /* The consensus has at least one exit, and can therefore (potentially) + * create exit and internal paths, circuits, streams, ... */ + CONSENSUS_PATH_EXIT = 1 +} consensus_path_type_t; +consensus_path_type_t router_have_consensus_path(void); + void router_dir_info_changed(void); const char *get_dir_info_status_string(void); int count_loading_descriptors_progress(void); |