summaryrefslogtreecommitdiff
path: root/src/feature/relay
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2022-11-23 14:54:43 -0500
committerDavid Goulet <dgoulet@torproject.org>2022-11-23 14:54:43 -0500
commit04d87536764f17267b88cb35106bc468020dcc65 (patch)
treead0489ff586e3e6b12693a659a08a13bd843b17e /src/feature/relay
parent8713d9762a79c46829891cafbcf1a972f0946065 (diff)
parentfbc9e92fdb364a741a3190fc22c6fa65d90e92e3 (diff)
downloadtor-04d87536764f17267b88cb35106bc468020dcc65.tar.gz
tor-04d87536764f17267b88cb35106bc468020dcc65.zip
Merge branch 'maint-0.4.7'
Diffstat (limited to 'src/feature/relay')
-rw-r--r--src/feature/relay/onion_queue.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/feature/relay/onion_queue.c b/src/feature/relay/onion_queue.c
index 6d1a6de15c..b844aefcd1 100644
--- a/src/feature/relay/onion_queue.c
+++ b/src/feature/relay/onion_queue.c
@@ -152,7 +152,13 @@ have_room_for_onionskin(uint16_t type)
/* If we've got fewer than 50 entries, we always have room for one more. */
if (ol_entries[type] < 50)
return 1;
- num_cpus = get_num_cpus(options);
+
+ /* If zero, this means our thread pool was never initialized meaning we can't
+ * really get here but make sure we don't have such value because we are
+ * using as a divisor. */
+ num_cpus = cpuworker_get_n_threads();
+ tor_assert(num_cpus > 0);
+
max_onion_queue_delay = get_onion_queue_max_delay(options);
/* Compute how many microseconds we'd expect to need to clear all