diff options
author | George Kadianakis <desnacked@riseup.net> | 2014-03-10 22:52:07 +0000 |
---|---|---|
committer | George Kadianakis <desnacked@riseup.net> | 2014-03-10 22:52:07 +0000 |
commit | 1c475eb018989f090c1423c25dc2f09380b10693 (patch) | |
tree | 07a71f4cc5aad46333bfdaf5b851204f231b9b78 /src/or/connection.c | |
parent | 0b7a66fac76445087651a1dd2d171bf043c9f345 (diff) | |
download | tor-1c475eb018989f090c1423c25dc2f09380b10693.tar.gz tor-1c475eb018989f090c1423c25dc2f09380b10693.zip |
Throw control port warning if we failed to connect to all our bridges.
Diffstat (limited to 'src/or/connection.c')
-rw-r--r-- | src/or/connection.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/or/connection.c b/src/or/connection.c index 77565eed50..653fa1cff7 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -4164,6 +4164,31 @@ connection_dir_get_by_purpose_and_resource(int purpose, return NULL; } +/** Return 1 if there are any active OR connections apart from + * <b>this_conn</b>. + * + * We use this to guess if we should tell the controller that we + * didn't manage to connect to any of our bridges. */ +int +any_other_active_or_conns(const or_connection_t *this_conn) +{ + smartlist_t *conns = get_connection_array(); + SMARTLIST_FOREACH_BEGIN(conns, connection_t *, conn) { + if (conn == TO_CONN(this_conn)) { /* don't consider this conn */ + continue; + } + + if (conn->type == CONN_TYPE_OR && + !conn->marked_for_close) { + log_debug(LD_DIR, "%s: Found an OR connection: %s", + __func__, conn->address); + return 1; + } + } SMARTLIST_FOREACH_END(conn); + + return 0; +} + /** Return 1 if <b>conn</b> is a listener conn, else return 0. */ int connection_is_listener(connection_t *conn) |