diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-11-21 17:25:51 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-11-21 17:25:51 -0500 |
commit | f4e053d6dff0b868449a8c225c2062b42083733f (patch) | |
tree | 337379ba96b60ab4d4e671821e3ea3eaa207e670 /src | |
parent | b3c988f0d7e18c243074e3e583c10b204521088f (diff) | |
parent | 8e388bc39ceb9b1a642359005b320cdc994f8a4e (diff) | |
download | tor-f4e053d6dff0b868449a8c225c2062b42083733f.tar.gz tor-f4e053d6dff0b868449a8c225c2062b42083733f.zip |
Merge branch 'bug4518' into maint-0.2.2
Diffstat (limited to 'src')
-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 c5e4863f7f..9d196d36eb 100644 --- a/src/or/cpuworker.c +++ b/src/or/cpuworker.c @@ -446,9 +446,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) { |