diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-03-11 11:04:47 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-03-11 11:04:47 -0400 |
commit | cce06b649edc51c67bba00c23d0b2b27ad2b892f (patch) | |
tree | ccce2a9a4d85da3bbd895c1e3ce2b30cccb44520 /src/or/connection.c | |
parent | b8ceb464e5949b07ba9bd007002a49f3ab9c600b (diff) | |
parent | 1c475eb018989f090c1423c25dc2f09380b10693 (diff) | |
download | tor-cce06b649edc51c67bba00c23d0b2b27ad2b892f.tar.gz tor-cce06b649edc51c67bba00c23d0b2b27ad2b892f.zip |
Merge remote-tracking branch 'asn/bug11069_take2'
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 46ce538190..19944161fb 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) |