diff options
author | Roger Dingledine <arma@torproject.org> | 2008-06-20 04:34:39 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2008-06-20 04:34:39 +0000 |
commit | 94dabd2c23bf86dcd603d53a1e0a678b77097737 (patch) | |
tree | ae4be6978766f346407a9c3d4eca92a793c944fc /src/or/circuitbuild.c | |
parent | dd50ffb1de2b408be2d6e5c0aba767d361bc80c5 (diff) | |
download | tor-94dabd2c23bf86dcd603d53a1e0a678b77097737.tar.gz tor-94dabd2c23bf86dcd603d53a1e0a678b77097737.zip |
If you're using bridges, generate "bootstrap problem" warnings
as soon as you run out of working bridges, rather than waiting
for ten failures -- which will never happen if you have less than
ten bridges.
svn:r15368
Diffstat (limited to 'src/or/circuitbuild.c')
-rw-r--r-- | src/or/circuitbuild.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index da96974623..8e89daf40f 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -3068,6 +3068,27 @@ any_bridge_descriptors_known(void) return choose_random_entry(NULL)!=NULL ? 1 : 0; } +/** Return 1 if there are any directory conns fetching bridge descriptors + * that aren't marked for close. We use this to guess if we should tell + * the controller that we have a problem. */ +int +any_pending_bridge_descriptor_fetches(void) +{ + smartlist_t *conns = get_connection_array(); + SMARTLIST_FOREACH(conns, connection_t *, conn, + { + if (conn->type == CONN_TYPE_DIR && + conn->purpose == DIR_PURPOSE_FETCH_SERVERDESC && + TO_DIR_CONN(conn)->router_purpose == ROUTER_PURPOSE_BRIDGE && + !conn->marked_for_close && + conn->linked && !conn->linked_conn->marked_for_close) { + log_debug(LD_DIR, "found one: %s", conn->address); + return 1; + } + }); + return 0; +} + /** Return 1 if we have at least one descriptor for a bridge and * all descriptors we know are down. Else return 0. If <b>act</b> is * 1, then mark the down bridges up; else just observe and report. */ |