summaryrefslogtreecommitdiff
path: root/src/or/rendclient.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-05-22 15:49:14 +0000
committerNick Mathewson <nickm@torproject.org>2007-05-22 15:49:14 +0000
commit6975a093e965e73ee88efe70b79a2211b9f5d7d3 (patch)
treea71662257de43d57a577da4c2aa2ef777941329c /src/or/rendclient.c
parente935d73b34094a88dbd997769be1c52b633fc3d3 (diff)
downloadtor-6975a093e965e73ee88efe70b79a2211b9f5d7d3.tar.gz
tor-6975a093e965e73ee88efe70b79a2211b9f5d7d3.zip
r12853@catbus: nickm | 2007-05-22 11:36:54 -0400
Make connection_array into a smartlist. svn:r10292
Diffstat (limited to 'src/or/rendclient.c')
-rw-r--r--src/or/rendclient.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/or/rendclient.c b/src/or/rendclient.c
index f6d24595f4..c65aa9513b 100644
--- a/src/or/rendclient.c
+++ b/src/or/rendclient.c
@@ -433,17 +433,15 @@ rend_client_desc_here(const char *query)
edge_connection_t *conn;
rend_cache_entry_t *entry;
time_t now = time(NULL);
- int i, n_conns;
- connection_t **carray;
- get_connection_array(&carray, &n_conns);
-
- for (i = 0; i < n_conns; ++i) {
- if (carray[i]->type != CONN_TYPE_AP ||
- carray[i]->state != AP_CONN_STATE_RENDDESC_WAIT ||
- carray[i]->marked_for_close)
+ smartlist_t *conns = get_connection_array();
+ SMARTLIST_FOREACH(conns, connection_t *, _conn,
+ {
+ if (_conn->type != CONN_TYPE_AP ||
+ _conn->state != AP_CONN_STATE_RENDDESC_WAIT ||
+ _conn->marked_for_close)
continue;
- conn = TO_EDGE_CONN(carray[i]);
+ conn = TO_EDGE_CONN(_conn);
if (rend_cmp_service_ids(query, conn->rend_query))
continue;
assert_connection_ok(TO_CONN(conn), now);
@@ -470,7 +468,7 @@ rend_client_desc_here(const char *query)
"unavailable (try again later).", safe_str(query));
connection_mark_unattached_ap(conn, END_STREAM_REASON_RESOLVEFAILED);
}
- }
+ });
}
/** Return a newly allocated extend_info_t* for a randomly chosen introduction