From 94dabd2c23bf86dcd603d53a1e0a678b77097737 Mon Sep 17 00:00:00 2001 From: Roger Dingledine Date: Fri, 20 Jun 2008 04:34:39 +0000 Subject: 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 --- src/or/circuitbuild.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/or/circuitbuild.c') 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 act is * 1, then mark the down bridges up; else just observe and report. */ -- cgit v1.2.3-54-g00ecf