aboutsummaryrefslogtreecommitdiff
path: root/src/lib/evloop/workqueue.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-02-20 12:21:23 -0500
committerNick Mathewson <nickm@torproject.org>2019-02-20 12:24:34 -0500
commitb3416476b487304426296173dd177e1277388e48 (patch)
tree4f3313caacd7fe6ec0e46e2222eace7c57df78c9 /src/lib/evloop/workqueue.c
parent97b9dfe3052f1fe3b14f47fc1326e235f96305b7 (diff)
downloadtor-b3416476b487304426296173dd177e1277388e48.tar.gz
tor-b3416476b487304426296173dd177e1277388e48.zip
Remove all uses of weak_rng.
I'm not removing the weak_rng code itself yet, since it is possible that we will want to revert one of these.
Diffstat (limited to 'src/lib/evloop/workqueue.c')
-rw-r--r--src/lib/evloop/workqueue.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/src/lib/evloop/workqueue.c b/src/lib/evloop/workqueue.c
index b36a02da5e..015b694290 100644
--- a/src/lib/evloop/workqueue.c
+++ b/src/lib/evloop/workqueue.c
@@ -59,9 +59,6 @@ struct threadpool_s {
* <b>p</b> is work[p]. */
work_tailq_t work[WORKQUEUE_N_PRIORITIES];
- /** Weak RNG, used to decide when to ignore priority. */
- tor_weak_rng_t weak_rng;
-
/** The current 'update generation' of the threadpool. Any thread that is
* at an earlier generation needs to run the update function. */
unsigned generation;
@@ -238,7 +235,7 @@ worker_thread_extract_next_work(workerthread_t *thread)
this_queue = &pool->work[i];
if (!TOR_TAILQ_EMPTY(this_queue)) {
queue = this_queue;
- if (! tor_weak_random_one_in_n(&pool->weak_rng,
+ if (! crypto_fast_rng_one_in_n(get_thread_fast_rng(),
thread->lower_priority_chance)) {
/* Usually we'll just break now, so that we can get out of the loop
* and use the queue where we found work. But with a small
@@ -555,11 +552,6 @@ threadpool_new(int n_threads,
for (i = WORKQUEUE_PRIORITY_FIRST; i <= WORKQUEUE_PRIORITY_LAST; ++i) {
TOR_TAILQ_INIT(&pool->work[i]);
}
- {
- unsigned seed;
- crypto_rand((void*)&seed, sizeof(seed));
- tor_init_weak_random(&pool->weak_rng, seed);
- }
pool->new_thread_state_fn = new_thread_state_fn;
pool->new_thread_state_arg = arg;