summaryrefslogtreecommitdiff
path: root/src/or/cpuworker.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/cpuworker.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/cpuworker.c')
-rw-r--r--src/or/cpuworker.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/or/cpuworker.c b/src/or/cpuworker.c
index 3bc6f9601b..4b23f58f39 100644
--- a/src/or/cpuworker.c
+++ b/src/or/cpuworker.c
@@ -412,14 +412,10 @@ process_pending_task(connection_t *cpuworker)
static void
cull_wedged_cpuworkers(void)
{
- connection_t **carray;
- connection_t *conn;
- int n_conns, i;
time_t now = time(NULL);
-
- get_connection_array(&carray, &n_conns);
- for (i = 0; i < n_conns; ++i) {
- conn = carray[i];
+ smartlist_t *conns = get_connection_array();
+ SMARTLIST_FOREACH(conns, connection_t *, conn,
+ {
if (!conn->marked_for_close &&
conn->type == CONN_TYPE_CPUWORKER &&
conn->state == CPUWORKER_STATE_BUSY_ONION &&
@@ -430,7 +426,7 @@ cull_wedged_cpuworkers(void)
num_cpuworkers--;
connection_mark_for_close(conn);
}
- }
+ });
}
/** If cpuworker is defined, assert that he's idle, and use him. Else,