diff options
author | Roger Dingledine <arma@torproject.org> | 2011-11-21 18:36:49 -0500 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2011-11-21 18:36:49 -0500 |
commit | 6a76007b089a2ca31b67b2ce15dd28edeb416428 (patch) | |
tree | d61bc05bc50b9f4ac8782f321ae6af960c8fa9db /src/or/cpuworker.c | |
parent | c9f24edb13faf17dc314be51127736acfc3de17a (diff) | |
parent | 97a209ea28f1b64fba51157e3e695c676eb0cf8e (diff) | |
download | tor-6a76007b089a2ca31b67b2ce15dd28edeb416428.tar.gz tor-6a76007b089a2ca31b67b2ce15dd28edeb416428.zip |
Merge branch 'maint-0.2.2'
Conflicts:
src/or/dirserv.c
Diffstat (limited to 'src/or/cpuworker.c')
-rw-r--r-- | src/or/cpuworker.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/or/cpuworker.c b/src/or/cpuworker.c index bf8964c29c..914003790a 100644 --- a/src/or/cpuworker.c +++ b/src/or/cpuworker.c @@ -445,9 +445,19 @@ assign_onionskin_to_cpuworker(connection_t *cpuworker, { char qbuf[1]; char tag[TAG_LEN]; + time_t now = approx_time(); + static time_t last_culled_cpuworkers = 0; - cull_wedged_cpuworkers(); - spawn_enough_cpuworkers(); + /* Checking for wedged cpuworkers requires a linear search over all + * connections, so let's do it only once a minute. + */ +#define CULL_CPUWORKERS_INTERVAL 60 + + if (last_culled_cpuworkers + CULL_CPUWORKERS_INTERVAL <= now) { + cull_wedged_cpuworkers(); + spawn_enough_cpuworkers(); + last_culled_cpuworkers = now; + } if (1) { if (num_cpuworkers_busy == num_cpuworkers) { |